8000 0.95-bugfixes: Apply fix to LazyUser from [3754] · django/django@e89f0a6 · GitHub
[go: up one dir, main page]

Skip to content

Commit e89f0a6

Browse files
committed
0.95-bugfixes: Apply fix to LazyUser from [3754]
git-svn-id: http://code.djangoproject.com/svn/django/branches/0.95-bugfixes@4361 bcc190cf-cafb-0310-a4f2-bffc1f526a37
1 parent a132d41 commit e89f0a6

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

django/contrib/auth/middleware.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
class 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

118
class AuthenticationMiddleware(object):
129
def process_request(self, request):

0 commit comments

Comments
 (0)
0