Ticket #4049: AuthenticationMiddleware.diff
File AuthenticationMiddleware.diff, 910 bytes (added by , 17 years ago) |
---|
-
django/core/context_processors.py
12 12 def auth(request): 13 13 """ 14 14 Returns context variables required by apps that use Django's authentication 15 system. 15 system. Function check that request has an attribute 'user' added by 16 presumably middleware or other code, if not return empty dictionary. 16 17 """ 17 return { 18 'user': request.user, 19 'messages': request.user.get_and_delete_messages(), 20 'perms': PermWrapper(request.user), 21 } 18 try: 19 return { 20 'user': request.user, 21 'messages': request.user.get_and_delete_messages(), 22 'perms': PermWrapper(request.user), 23 } 24 except AttributeError: 25 return {}