Skip to content

Commit

Permalink
Add exception handler for AnonymousUser
Browse files Browse the repository at this point in the history
  • Loading branch information
gchandrasa committed Sep 7, 2012
1 parent 2ab6823 commit 49e913a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions authors.rst
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
Author:
* Selwin Ong

Contributors:
* Gilang Chandrasa
3 changes: 2 additions & 1 deletion cached_auth/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ def get_cached_user(request):
if profile_model:
try:
user.get_profile()
except profile_model.DoesNotExist:
# Handle exception for user with no profile and AnonymousUser
except (profile_model.DoesNotExist, AttributeError):
pass
cache.set(key, user)
request._cached_user = user
Expand Down

0 comments on commit 49e913a

Please sign in to comment.