diff options
author | gasperfele@fri1.uni-lj.si <gasperfele@fri1.uni-lj.si@5cf9fbd1-b2bc-434c-b4b7-e852f4f63414> | 2015-01-14 15:37:41 +0000 |
---|---|---|
committer | gasperfele@fri1.uni-lj.si <gasperfele@fri1.uni-lj.si@5cf9fbd1-b2bc-434c-b4b7-e852f4f63414> | 2015-01-14 15:37:41 +0000 |
commit | 4eea296e6e63cb4671a7cc19f00cb85319899015 (patch) | |
tree | 0a9f50ab76a51fc55a9cd00697bab75a1a87224a /kpov_judge/web | |
parent | c0999c1cb5041cfa1295e79e7e22415383839b54 (diff) |
Adding howtos now works
git-svn-id: https://svn.lusy.fri.uni-lj.si/kpov-public-svn/kpov-public@190 5cf9fbd1-b2bc-434c-b4b7-e852f4f63414
Diffstat (limited to 'kpov_judge/web')
-rwxr-xr-x | kpov_judge/web/kpov_judge/kpov_judge.py | 14 | ||||
-rw-r--r-- | kpov_judge/web/kpov_judge/templates/task_greeting.html | 3 |
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> |