Mercurial > public > sg101
comparison wiki/signals.py @ 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 |
comparison
equal
deleted
inserted
replaced
629:f4c043cf55ac | 630:63603e931503 |
---|---|
32 Since the user is about to logout, her session will be wiped out after | 32 Since the user is about to logout, her session will be wiped out after |
33 this function returns. This forces us to set an attribute on the request | 33 this function returns. This forces us to set an attribute on the request |
34 object so that the response middleware can delete the wiki's cookie. | 34 object so that the response middleware can delete the wiki's cookie. |
35 | 35 |
36 """ | 36 """ |
37 logger.info('User logout: %s', user.username) | 37 if user: |
38 logger.info('User logout: %s', user.username) | |
38 | 39 |
39 # Remember what Redis set member to delete by adding an attribute to the | 40 # Remember what Redis set member to delete by adding an attribute to the |
40 # request object: | 41 # request object: |
41 request.wiki_delete_cookie = request.session.get(SESSION_SET_MEMBER) | 42 request.wiki_delete_cookie = request.session.get(SESSION_SET_MEMBER) |
42 | 43 |
43 | 44 |
44 user_logged_in.connect(login_callback, dispatch_uid='wiki.signals.login') | 45 user_logged_in.connect(login_callback, dispatch_uid='wiki.signals.login') |
45 user_logged_out.connect(logout_callback, dispatch_uid='wiki.signals.logout') | 46 user_logged_out.connect(logout_callback, dispatch_uid='wiki.signals.logout') |