summaryrefslogtreecommitdiffstats
path: root/app/main.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/main.py')
-rw-r--r--app/main.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/main.py b/app/main.py
index 1934c23..8ca26bc 100644
--- a/app/main.py
+++ b/app/main.py
@@ -2,7 +2,7 @@
import os, sys
from flask import Blueprint, render_template, request, flash, redirect,\
- url_for, current_app, g
+ url_for, current_app, g, abort
from werkzeug.utils import secure_filename
from wtforms.validators import ValidationError
from .backend import Storage
@@ -76,7 +76,11 @@ def upload(study, course = None):
@main.route('/<study>/courses/<course>')
def courses_show(study, course = None):
""" Lists all courses or exams for a course """
- backend = get_studies()[study]
+ studies = get_studies()
+ if study not in studies:
+ abort(404)
+
+ backend = studies[study]
if course:
entries = sorted(backend.get_exams(course), reverse = True)
return render_template('exams.html', study = study, course = course,