summaryrefslogtreecommitdiff
path: root/kpov_judge/web
diff options
context:
space:
mode:
Diffstat (limited to 'kpov_judge/web')
-rwxr-xr-xkpov_judge/web/kpov_judge/kpov_judge.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/kpov_judge/web/kpov_judge/kpov_judge.py b/kpov_judge/web/kpov_judge/kpov_judge.py
index 1605089..5d3e791 100755
--- a/kpov_judge/web/kpov_judge/kpov_judge.py
+++ b/kpov_judge/web/kpov_judge/kpov_judge.py
@@ -90,10 +90,10 @@ def results_post(class_id, task_id, results):
params[param_name] = user_params[param_name]
try:
task_check_source = db.task_checkers.find_one({'class_id': class_id, 'task_id': task_id})['source']
- task_check_code = compile(task_check_source, 'checker.py', 'exec')
- exec(task_check_code)
+ d = {}
+ exec(compile(task_check_source, 'checker.py', 'exec'), d)
# raise Exception(str(params))
- res, hints = task_check(results, params)
+ res, hints = d['task_check'](results, params)
except Exception as e:
hints = ["Checker died: " + str(e)]
res = 0
@@ -187,11 +187,12 @@ def get_params(class_id, task_id, student_id, db):
try:
gen_params_source = db.gen_params.find_one({'class_id': class_id, 'task_id': task_id})['source']
gen_params_code = compile(gen_params_source, 'generator.py', 'exec')
- exec(gen_params_code)
- params = gen_params(student_id, meta)
+ d = {}
+ exec(gen_params_code, d)
+ params = d['gen_params'](student_id, meta)
db.task_params.update({'class_id': class_id, 'task_id': task_id, 'student_id': student_id},
{'$set': {'params': params}}, upsert=True)
- params = gen_params(student_id, meta)
+ params = d['gen_params'](student_id, meta) # TODO this is repeated, is it necessary?
for computer in db.computers_meta.find({'class_id': class_id, 'task_id': task_id}):
try:
name = computer.pop('name')