Commits

uber...@bcc190cf-cafb-0310-a4f2-bffc1f526a37  committed 789e38f

0.95-bugfixes: Apply fix to LazyUser from [3754]

  • Participants
  • Parent commits 90df23c
  • Branches 0.95-bugfixes

Comments (0)

Files changed (1)

File django/contrib/auth/middleware.py

 class LazyUser(object):
-    def __init__(self):
-        self._user = None
-
     def __get__(self, request, obj_type=None):
-        if self._user is None:
+        if not hasattr(request, '_cached_user'):
             from django.contrib.auth import get_user
-            self._user = get_user(request)
-        return self._user
+            request._cached_user = get_user(request)
+        return request._cached_user
 
 class AuthenticationMiddleware(object):
     def process_request(self, request):