Ticket #2702: lazyuser.diff
File lazyuser.diff, 742 bytes (added by , 18 years ago) |
---|
-
django/contrib/auth/middleware.py
1 1 class LazyUser(object): 2 def __init__(self):3 self._user = None4 5 2 def __get__(self, request, obj_type=None): 6 if self._user is None:3 if not hasattr(request, '_cached_user'): 7 4 from django.contrib.auth import get_user 8 self._user = get_user(request)9 return self._user5 request._cached_user = get_user(request) 6 return request._cached_user 10 7 11 8 class AuthenticationMiddleware(object): 12 9 def process_request(self, request):