Author: ubernostrum
Date: 2007-01-19 20:05:02 -0600 (Fri, 19 Jan 2007)
New Revision: 4361

Modified:
   django/branches/0.95-bugfixes/django/contrib/auth/middleware.py
Log:
0.95-bugfixes: Apply fix to LazyUser from [3754]


Modified: django/branches/0.95-bugfixes/django/contrib/auth/middleware.py
===================================================================
--- django/branches/0.95-bugfixes/django/contrib/auth/middleware.py     
2007-01-20 02:02:07 UTC (rev 4360)
+++ django/branches/0.95-bugfixes/django/contrib/auth/middleware.py     
2007-01-20 02:05:02 UTC (rev 4361)
@@ -1,12 +1,9 @@
 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):


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to