From: philipp Date: Sun, 30 Jul 2017 21:25:18 +0000 (+0000) Subject: rodelbahn_update works now. X-Git-Url: https://git.toastfreeware.priv.at/philipp/winterrodeln/wradmin.git/commitdiff_plain/93728aad9d95a2018c0bfc0390076401d3655a02 rodelbahn_update works now. git-svn-id: http://www.winterrodeln.org/svn/wradmin/trunk@2685 7aebc617-e5e2-0310-91dc-80fb5f6d2477 --- diff --git a/wradmin/__init__.py b/wradmin/__init__.py index 8a35e9d..4e98920 100644 --- a/wradmin/__init__.py +++ b/wradmin/__init__.py @@ -43,17 +43,18 @@ def rodelbahn_list(): return RodelbahnController().list() -@app.route("/rodelbahn/update") -def rodelbahn_update(): - pass - - @app.route("/rodelbahn/view/") def rodelbahn_view(id): get_db() return RodelbahnController().view(id) +@app.route("/rodelbahn/update") +def rodelbahn_update(): + get_db() + return RodelbahnController().update() + + @app.route("/rodelbahn/update_regioncache") def rodelbahn_update_regioncache(): pass diff --git a/wradmin/controllers/rodelbahn.py b/wradmin/controllers/rodelbahn.py index ab67570..5af866e 100644 --- a/wradmin/controllers/rodelbahn.py +++ b/wradmin/controllers/rodelbahn.py @@ -1,7 +1,5 @@ #!/usr/bin/python3.4 -#from pylons import request, response, session, url, tmpl_context as c -#from pylons.controllers.util import abort, redirect -from flask import request, abort, url_for +from flask import request, abort, redirect, session, url_for import paginate import sqlalchemy as sa @@ -40,7 +38,7 @@ class RodelbahnController: return render_genshi_template('rodelbahn_view.html', c=c) def update(self): - "Updates the wrsledruncache table from the wiki" + """Updates the wrsledruncache table from the wiki""" c = model.meta.Session.connection() try: wrpylib.wrmwcache.update_wrsledruncache(c) @@ -53,10 +51,8 @@ class RodelbahnController: msg = msg.replace('\n', '; ') if len(e.args) == 3: session['flash'] = "Fehler bei Rodelbahn '{0}': {1}".format(title, msg) else: session['flash'] = str(e) - session.save() # Redirect to result page - return redirect(url(controller='rodelbahn', action='list')) - + return redirect(url_for('rodelbahn_list')) def update_regioncache(self): "Updates the wrregioncache table from the wiki"