From a0c78c82a5cb3a69f66a4ed631b555e3df54d6e5 Mon Sep 17 00:00:00 2001 From: "gasperfele@fri1.uni-lj.si" Date: Tue, 31 Mar 2015 15:19:26 +0000 Subject: Fixed generation of disk images git-svn-id: https://svn.lusy.fri.uni-lj.si/kpov-public-svn/kpov-public@294 5cf9fbd1-b2bc-434c-b4b7-e852f4f63414 --- kpov_judge/web/kpov_judge/kpov_judge.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 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 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) -- cgit v1.2.1