From 003e89608d5fd0ee13dbbe6f61654aeebebede43 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Thu, 21 Feb 2019 00:39:16 +0100 Subject: web.task_source: return the empty string for invalid task --- kpov_judge/web/kpov_judge/kpov_judge.py | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) (limited to 'kpov_judge/web') 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///task.html') -- cgit v1.2.1