Kaydet (Commit) c694587e authored tarafından Malcolm Tredinnick's avatar Malcolm Tredinnick

Fixed #4049 -- Improved error handling in auth() context processor. Based on a patch from gregorth.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6356 bcc190cf-cafb-0310-a4f2-bffc1f526a37
üst e988aa39
......@@ -13,11 +13,19 @@ def auth(request):
"""
Returns context variables required by apps that use Django's authentication
system.
If there is no 'user' attribute in the request, uses AnonymousUser (from
django.contrib.auth).
"""
if hasattr(request, 'user'):
user = request.user
else:
from django.contrib.auth.models import AnonymousUser
user = AnonymousUser()
return {
'user': request.user,
'messages': request.user.get_and_delete_messages(),
'perms': PermWrapper(request.user),
'user': user,
'messages': user.get_and_delete_messages(),
'perms': PermWrapper(user),
}
def debug(request):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment