diff options
Diffstat (limited to 'kpov_judge/web')
-rwxr-xr-x | kpov_judge/web/kpov_judge/kpov_judge.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/kpov_judge/web/kpov_judge/kpov_judge.py b/kpov_judge/web/kpov_judge/kpov_judge.py index 7171c7f..ef7d542 100755 --- a/kpov_judge/web/kpov_judge/kpov_judge.py +++ b/kpov_judge/web/kpov_judge/kpov_judge.py @@ -199,18 +199,22 @@ def task_greeting(task_id, lang): # generate the parameters as soon as the student visits params, meta = get_params(task_id, student_id, db) try: - public_params = dict() - for k, v in meta: - if meta.get('public', False): - public_params[k] = params.get(k, "???") instructions = db.task_instructions.find({'task_id': task_id})[0] instructions = instructions.get(lang, - app.config['DEFAULT_LANG']).format(**public_params) + app.config['DEFAULT_LANG']) except: try: instructions = instructions.values()[0] except Exception, e: instructions = str(e) + try: + public_params = dict() + for k, v in meta.iteritems(): + if v.get('public', False): + public_params[k] = params.get(k, "???") + instructions = instructions.format(**public_params) + except Exception, e: + instructions = str(e) computer_list = db.student_computers.find({'task_id':task_id, 'student_id': student_id}) if request.args.get('narediStack', 'false') == 'true': #db.student_tasks.update({'task_id':task_id, 'student_id': student_id}, {'$set': {'create_openstack': True}}, upsert = True) |