summaryrefslogtreecommitdiff
path: root/kpov_judge/web
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@fri.uni-lj.si>2018-09-26 16:23:29 +0200
committerTimotej Lazar <timotej.lazar@fri.uni-lj.si>2018-09-26 16:23:29 +0200
commit03c9d6d8441e3293b058fed270866419781b734c (patch)
treea456f12f5c26c836685c6e47c95cfe2897e43723 /kpov_judge/web
parent3938c69f3e1586c1ffbcae5395414ca8480e6ba4 (diff)
Run 2to3
Some stuff is broken now.
Diffstat (limited to 'kpov_judge/web')
-rw-r--r--kpov_judge/web/kpov_judge/kpov_draw_setup.py4
-rwxr-xr-xkpov_judge/web/kpov_judge/kpov_judge.py16
2 files changed, 10 insertions, 10 deletions
diff --git a/kpov_judge/web/kpov_judge/kpov_draw_setup.py b/kpov_judge/web/kpov_judge/kpov_draw_setup.py
index 0042389..41f5e01 100644
--- a/kpov_judge/web/kpov_judge/kpov_draw_setup.py
+++ b/kpov_judge/web/kpov_judge/kpov_draw_setup.py
@@ -7,7 +7,7 @@ def draw_setup(computers, networks, destination=None,
icon_suffix = format
icon_suffix = '.' + icon_suffix
G = pgv.AGraph(imagepath=icon_path + '/')
- print G.graph_attr
+ print(G.graph_attr)
have_internet = []
for net in networks:
net_name = net.get('name', 'net')
@@ -39,5 +39,5 @@ def draw_setup(computers, networks, destination=None,
if __name__ == '__main__':
import sample_task as task
- print draw_setup(task.computers, task.networks)
+ print(draw_setup(task.computers, task.networks))
diff --git a/kpov_judge/web/kpov_judge/kpov_judge.py b/kpov_judge/web/kpov_judge/kpov_judge.py
index 2b1d3c6..1605089 100755
--- a/kpov_judge/web/kpov_judge/kpov_judge.py
+++ b/kpov_judge/web/kpov_judge/kpov_judge.py
@@ -85,7 +85,7 @@ def results_post(class_id, task_id, results):
meta = {}
else:
meta = meta['params']
- for param_name, param_meta in meta.iteritems():
+ for param_name, param_meta in meta.items():
if param_meta.get('w', False) and param_name in user_params:
params[param_name] = user_params[param_name]
try:
@@ -151,7 +151,7 @@ def public_meta(db, class_id, task_id):
shown = {}
try:
meta = db.task_params_meta.find_one({'class_id': class_id, 'task_id': task_id})['params']
- for k, v in meta.iteritems():
+ for k, v in meta.items():
try:
if v['public']:
shown[k] = v
@@ -239,14 +239,14 @@ def task_greeting(class_id, task_id, lang):
instructions = instructions.get(lang, instructions[app.config['DEFAULT_LANG']])
except Exception:
try:
- instructions = instructions.values()[0]
+ instructions = list(instructions.values())[0]
except Exception as e:
instructions = str(e)
instr_ok = False
if instr_ok:
try:
public_params = {}
- for k, v in meta.iteritems():
+ for k, v in meta.items():
if v.get('public', False):
public_params[k] = params.get(k, "???")
# instructions = instructions.format(**public_params).decode('utf8')
@@ -280,14 +280,14 @@ def params_json(class_id, task_id):
new_params = json.loads(flask.app.request.form['params'])
except Exception:
new_params = {}
- for name in params.iteritems():
+ for name in params.items():
if meta.get(name, {'w': False}).get('w', False) and k in new_params:
params[name] = new_params[name]
if meta.get(name, {'public': False})['public']:
shown_params[name] = params[name]
db.task_params.update({'class_id': class_id, 'task_id': task_id, 'student_id': student_id}, {'$set': {'params': params}})
else:
- for name, param in params.iteritems():
+ for name, param in params.items():
if meta.get(name, {'public': False})['public']:
shown_params[name] = param
return json.dumps(shown_params)
@@ -299,13 +299,13 @@ def params_html(class_id, task_id, lang):
db = g.db
params, meta = get_params(class_id, task_id, student_id, db)
shown_params = {}
- for name, meta_param in meta.iteritems():
+ for name, meta_param in meta.items():
if meta_param.get('public', False):
shown_params[name] = params.get(name, '')
if flask.app.request.method == 'POST':
form = flask.app.request.form
new_params = {}
- for k, v in meta.iteritems():
+ for k, v in meta.items():
if v.get('w', False):
params[k] = flask.app.request.form[k]
if v.get('public', False):