From: philipp Date: Fri, 25 Oct 2019 14:58:25 +0000 (+0000) Subject: Implement update_wrmapcache functionality from GUI. X-Git-Url: https://git.toastfreeware.priv.at/philipp/winterrodeln/wradmin.git/commitdiff_plain/d126c9a8fd9fac41d26dc98df5ed4883d8ee2ffb?ds=sidebyside Implement update_wrmapcache functionality from GUI. git-svn-id: http://www.winterrodeln.org/svn/wradmin/trunk@2833 7aebc617-e5e2-0310-91dc-80fb5f6d2477 --- diff --git a/wradmin/__init__.py b/wradmin/__init__.py index ba056c1..c80fc17 100644 --- a/wradmin/__init__.py +++ b/wradmin/__init__.py @@ -54,6 +54,9 @@ def rodelbahn_update(): def rodelbahn_update_regioncache(): return RodelbahnController().update_regioncache() +@app.route("/rodelbahn/update_mapcache") +def rodelbahn_update_mapcache(): + return RodelbahnController().update_mapcache() @app.route("/bericht/list") def bericht_list(): diff --git a/wradmin/controllers/rodelbahn.py b/wradmin/controllers/rodelbahn.py index 0b166fe..f6bd26d 100644 --- a/wradmin/controllers/rodelbahn.py +++ b/wradmin/controllers/rodelbahn.py @@ -64,3 +64,15 @@ class RodelbahnController: flash(str(e), 'error') # Redirect to result page return redirect(url_for('rodelbahn_list')) + + def update_mapcache(self): + """Updates the wrmappointcache and wrmappathcache tables from the wiki.""" + c = model.meta.Session.connection() + try: + wrpylib.wrmwcache.update_wrmapcache(c) + model.meta.Session.commit() + flash('Die Landkarteninformationen aus dem Wiki wurden erfolgreich aktualisiesrt.', 'info') + except wrpylib.wrmwcache.UpdateCacheError as e: + flash(str(e), 'error') + # Redirect to result page + return redirect(url_for('rodelbahn_list')) diff --git a/wradmin/templates/rodelbahn_list.html b/wradmin/templates/rodelbahn_list.html index e67900d..f011f39 100644 --- a/wradmin/templates/rodelbahn_list.html +++ b/wradmin/templates/rodelbahn_list.html @@ -8,6 +8,7 @@ (1) Rodelbahnboxen auslesen und DB aktualisieren (2) Rodelbahnen in den Regionslisten aktualisieren +(3) Landkarten aktualisieren

{{paginator.pager('$link_first $link_previous $first_item bis $last_item von $item_count $link_next $link_last') | safe}}