changeset 630:63603e931503

Fix bug; user_logged_out signal can be sent with user is None.
author Brian Neal <bgneal@gmail.com>
date Wed, 14 Nov 2012 17:47:01 -0600
parents f4c043cf55ac
children f36d1a168be7
files wiki/signals.py
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/wiki/signals.py	Tue Nov 13 13:50:06 2012 -0600
+++ b/wiki/signals.py	Wed Nov 14 17:47:01 2012 -0600
@@ -34,11 +34,12 @@
     object so that the response middleware can delete the wiki's cookie.
 
     """
-    logger.info('User logout: %s', user.username)
+    if user:
+        logger.info('User logout: %s', user.username)
 
-    # Remember what Redis set member to delete by adding an attribute to the
-    # request object:
-    request.wiki_delete_cookie = request.session.get(SESSION_SET_MEMBER)
+        # Remember what Redis set member to delete by adding an attribute to the
+        # request object:
+        request.wiki_delete_cookie = request.session.get(SESSION_SET_MEMBER)
 
 
 user_logged_in.connect(login_callback, dispatch_uid='wiki.signals.login')