summaryrefslogtreecommitdiff
path: root/kpov_judge/web
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@fri.uni-lj.si>2018-10-05 18:04:45 +0200
committerTimotej Lazar <timotej.lazar@fri.uni-lj.si>2018-10-05 18:04:45 +0200
commit772532d87cc97828d1e29c0ca91f50112f5a6ede (patch)
tree23cb1188889cd115c525cc3fe83a3a0adb332cac /kpov_judge/web
parentc54584bf5ae0b4973464da1e033c6628b82e9cd5 (diff)
Pass globals() to exec calls
Diffstat (limited to 'kpov_judge/web')
-rwxr-xr-xkpov_judge/web/kpov_judge/kpov_judge.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/kpov_judge/web/kpov_judge/kpov_judge.py b/kpov_judge/web/kpov_judge/kpov_judge.py
index 5d3e791..b190567 100755
--- a/kpov_judge/web/kpov_judge/kpov_judge.py
+++ b/kpov_judge/web/kpov_judge/kpov_judge.py
@@ -91,7 +91,7 @@ def results_post(class_id, task_id, results):
try:
task_check_source = db.task_checkers.find_one({'class_id': class_id, 'task_id': task_id})['source']
d = {}
- exec(compile(task_check_source, 'checker.py', 'exec'), d)
+ exec(compile(task_check_source, 'checker.py', 'exec'), globals(), d)
# raise Exception(str(params))
res, hints = d['task_check'](results, params)
except Exception as e:
@@ -188,7 +188,7 @@ def get_params(class_id, task_id, student_id, db):
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')
d = {}
- exec(gen_params_code, d)
+ exec(gen_params_code, globals(), 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)