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.py14
-rw-r--r--kpov_judge/web/kpov_judge/templates/task_greeting.html3
2 files changed, 16 insertions, 1 deletions
diff --git a/kpov_judge/web/kpov_judge/kpov_judge.py b/kpov_judge/web/kpov_judge/kpov_judge.py
index 6b1f144..0499b11 100755
--- a/kpov_judge/web/kpov_judge/kpov_judge.py
+++ b/kpov_judge/web/kpov_judge/kpov_judge.py
@@ -8,6 +8,7 @@ import random
import settings
import datetime
import kpov_random_helpers
+import traceback
app = Flask(__name__)
app.config.from_object(settings)
@@ -169,7 +170,8 @@ def get_params(task_id, student_id, db):
{'$set': computer}, upsert=True)
except Exception, e:
meta = {'crash':{'public': True}}
- params = {'crash': "Parameter creator crashed or missing:" + str(e)}
+ params = {'crash': "Parameter creator crashed or missing:\n{}".format(
+ traceback.format_exc())}
else:
params = params['params']
return params, meta
@@ -179,6 +181,16 @@ def task_lang_redirect(task_id):
return redirect(url_for('task_greeting', task_id = task_id,
lang=app.config['DEFAULT_LANG']))
+@app.route('/tasks/<task_id>/<lang>/howto/', methods = ['GET'])
+def task_howto(task_id, lang):
+ db = g.db
+ return db.howtos.find({'task_id': task_id, 'lang':lang})[0].get('text', '')
+
+@app.route('/tasks/<task_id>/<lang>/images/<fname>', methods = ['GET'])
+def task_image(task_id, lang, fname):
+ db = g.db
+ return db.howto_images.find({'task_id': task_id, 'fname':fname})[0].get('data', '')
+
@app.route('/tasks/<task_id>/<lang>/', methods = ['GET'])
def task_greeting(task_id, lang):
student_id = flask.app.request.environ.get('REMOTE_USER', 'Nobody')
diff --git a/kpov_judge/web/kpov_judge/templates/task_greeting.html b/kpov_judge/web/kpov_judge/templates/task_greeting.html
index bceb18c..b1ede6c 100644
--- a/kpov_judge/web/kpov_judge/templates/task_greeting.html
+++ b/kpov_judge/web/kpov_judge/templates/task_greeting.html
@@ -8,6 +8,9 @@
{{instructions}}
</pre>
<p>
+<p>
+<a href='howto/'>Podrobna navodila (HOWTO)</a>
+</p>
<h2>Računalniki v vaji</h2>
{% for c in computers %}
<h3>{{c['name']}}</h3>