changeset 2916:ee6c2b013356

Fixes Issue #488 KeyError due to invalid session cookie
author Yask Srivastava <yask123@gmail.com>
date Mon, 09 Mar 2015 10:43:42 -0700
parents 0b30aa1fa138
children eb4e31a57a3a
files MoinMoin/app.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/app.py	Sat Feb 28 23:58:11 2015 -0800
+++ b/MoinMoin/app.py	Mon Mar 09 10:43:42 2015 -0700
@@ -208,7 +208,12 @@
     flaskg._login_messages = []
 
     # first try setting up from session
-    userobj = auth.setup_from_session()
+    try:
+        userobj = auth.setup_from_session()
+    except KeyError:
+        # error caused due to invalid cookie, recreating session
+        session.clear()
+        userobj = auth.setup_from_session()
 
     # then handle login/logout forms
     form = request.values.to_dict()