Ticket #2702: lazyuser.diff

File lazyuser.diff, 742 bytes (added by jkocherhans, 18 years ago)
  • django/contrib/auth/middleware.py

     
    11class LazyUser(object):
    2     def __init__(self):
    3         self._user = None
    4 
    52    def __get__(self, request, obj_type=None):
    6         if self._user is None:
     3        if not hasattr(request, '_cached_user'):
    74            from django.contrib.auth import get_user
    8             self._user = get_user(request)
    9         return self._user
     5            request._cached_user = get_user(request)
     6        return request._cached_user
    107
    118class AuthenticationMiddleware(object):
    129    def process_request(self, request):
Back to Top