]> ToastFreeware Gitweb - philipp/winterrodeln/wradmin.git/blobdiff - wradmin/controllers/gasthaus.py
Now using flash messages again.
[philipp/winterrodeln/wradmin.git] / wradmin / controllers / gasthaus.py
index 61fc2416198e3044c25ee6b73e1324b6631a30fc..b1e9d2586ae8b7f547650a155c636571a86e3f9e 100644 (file)
@@ -1,5 +1,5 @@
 #!/usr/bin/python3.4
-from flask import request, abort, redirect, session, url_for
+from flask import request, abort, redirect, url_for, flash
 import paginate
 
 import wrpylib.wrmwmarkup
@@ -37,13 +37,14 @@ class GasthausController:
         try:
             wrpylib.wrmwcache.update_wrinncache(c)
             model.meta.Session.commit()
-            session['flash'] = 'Die Gasthausliste wurde erfolgreich aktualisiert.'
+            flash('Die Gasthausliste wurde erfolgreich aktualisiert.', 'info')
         except wrpylib.wrmwcache.UpdateCacheError as e:
             title = str(e.args[1])
             title = wrpylib.mwmarkup.to_title(title)
             msg = str(e.args[2])
             msg = msg.replace('\n', '; ')
-            if len(e.args) == 3: session['flash'] = "Fehler bei Gasthaus '{0}': {1}".format(title, msg)
-            else: session['flash'] = str(e)
+            if len(e.args) == 3:
+                flash("Fehler bei Gasthaus '{0}': {1}".format(title, msg), 'error')
+            else: flash(str(e), 'error')
         # Redirect to result page
         return redirect(url_for('gasthaus_list'))