diff options
author | Timotej Lazar <timotej.lazar@fri.uni-lj.si> | 2019-02-21 00:39:16 +0100 |
---|---|---|
committer | Timotej Lazar <timotej.lazar@fri.uni-lj.si> | 2019-02-21 00:39:54 +0100 |
commit | 003e89608d5fd0ee13dbbe6f61654aeebebede43 (patch) | |
tree | f066824dea979cc4d3bf9e0afef785d8d7ab154b /kpov_judge/web | |
parent | cd8fd82d09b3636c8667f64d6c3264ba18e118f9 (diff) |
web.task_source: return the empty string for invalid task
Diffstat (limited to 'kpov_judge/web')
-rwxr-xr-x | kpov_judge/web/kpov_judge/kpov_judge.py | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/kpov_judge/web/kpov_judge/kpov_judge.py b/kpov_judge/web/kpov_judge/kpov_judge.py index 7415724..47e413e 100755 --- a/kpov_judge/web/kpov_judge/kpov_judge.py +++ b/kpov_judge/web/kpov_judge/kpov_judge.py @@ -30,21 +30,6 @@ def get_locale(): return 'sl' return request.accept_languages.best_match(['sl', 'en']) -dummy_task = """ -def task(neznano_ime_naloge): - print "Ta naloga ne obstaja!" - return {'odgovor': 'neznana naloga'} - -def task_check(results, params): - raise Exception("neznana naloga?") - return "Manjka preverjalnik naloge (neznana naloga?)" - -def gen_params(user_id, meta): - return dict() - -params_meta = {'neznano_ime_naloge': {'opis':'NEZNANA NALOGA', 'w': False}} -""" - @app.before_request def before_request(): @@ -89,10 +74,9 @@ def setup_svg(class_id, task_id, lang, ending): def task_source(class_id, task_id): db = g.db try: - task_str = db.tasks.find_one({'class_id': class_id, 'task_id': task_id})['source'] - except Exception: - return dummy_task - return task_str + return db.tasks.find_one({'class_id': class_id, 'task_id': task_id})['source'] + except: + return '' @app.route('/tasks/<class_id>/<task_id>/task.html') |