[Checkins] SVN: z3c.authentication/trunk/src/z3c/authentication/cookie/plugin.py ignore credentials on logout which are not authenticated by this plugin

Bernd Dorn bernd.dorn at lovelysystems.com
Thu Nov 23 16:11:21 EST 2006


Log message for revision 71285:
  ignore credentials on logout which are not authenticated by this plugin

Changed:
  U   z3c.authentication/trunk/src/z3c/authentication/cookie/plugin.py

-=-
Modified: z3c.authentication/trunk/src/z3c/authentication/cookie/plugin.py
===================================================================
--- z3c.authentication/trunk/src/z3c/authentication/cookie/plugin.py	2006-11-23 16:28:08 UTC (rev 71284)
+++ z3c.authentication/trunk/src/z3c/authentication/cookie/plugin.py	2006-11-23 21:11:21 UTC (rev 71285)
@@ -242,9 +242,16 @@
 
         lifeTimeSessionData = lifeTimeSession.get(interfaces.SESSION_KEY)
         browserSessionData = browserSession.get(interfaces.BROWSER_SESSION_KEY)
-
-        # reset the session data
-        lifeTimeSessionData['credentials'] = None
-        browserSessionData['initialLogin'] = False
-        transaction.commit()
+        # reset the session data if there
+        changed = False
+        if lifeTimeSessionData is not None and \
+               lifeTimeSessionData.get('credentials') is not None:
+            lifeTimeSessionData['credentials'] = None
+            changed = True
+        if browserSessionData is not None and \
+               browserSessionData.get('initialLogin') is not False:
+            browserSessionData['initialLogin'] = False
+            changed = True
+        if changed:
+            transaction.commit()
         return True



More information about the Checkins mailing list