From a30cb3c64da93b8667ad55213d850eadcbad7844 Mon Sep 17 00:00:00 2001 From: "gasperfele@fri1.uni-lj.si" Date: Tue, 27 Oct 2015 16:50:24 +0000 Subject: Fixed encoding in pristopni_kolokvij git-svn-id: https://svn.lusy.fri.uni-lj.si/kpov-public-svn/kpov-public@345 5cf9fbd1-b2bc-434c-b4b7-e852f4f63414 --- kpov_judge/web/kpov_judge/kpov_judge.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 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 6302c3a..26d3b1d 100755 --- a/kpov_judge/web/kpov_judge/kpov_judge.py +++ b/kpov_judge/web/kpov_judge/kpov_judge.py @@ -190,21 +190,24 @@ def task_greeting(task_id, lang): instr_ok = True try: instructions = db.task_instructions.find({'task_id': task_id})[0] - instructions = instructions.get(lang, - app.config['DEFAULT_LANG']) + instructions = instructions.get(lang, instructions[app.config['DEFAULT_LANG']]) except Exception: try: instructions = instructions.values()[0] except Exception as e: instructions = str(e) instr_ok = False + instructions = instructions if instr_ok: try: public_params = {} for k, v in meta.iteritems(): if v.get('public', False): public_params[k] = params.get(k, "???") + # instructions = instructions.format(**public_params).decode('utf8') instructions = instructions.format(**public_params) + + # instructions = instructions.format(**public_params).encode('utf8') except Exception as e: instructions = str(e) computer_list = db.student_computers.find({'task_id': task_id, 'student_id': student_id}) -- cgit v1.2.1