diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2006-09-12 17:30:47 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2006-09-12 17:30:47 +0000 |
| commit | 3c5782287efc197eccf556cf6915fc0d8b3e02bd (patch) | |
| tree | 3b5b338dc0a7fc94766267bf67ac9f50c211bac7 | |
| parent | 086992c7390432b375c3aa49ff396941fc724a02 (diff) | |
Fixed #2702 -- Fixed LazyUser to store cache as attribute of request, not class. Thanks for the patch, jkocherhans
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3754 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/contrib/auth/middleware.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/django/contrib/auth/middleware.py b/django/contrib/auth/middleware.py index a6a60780a7..42dc15a366 100644 --- a/django/contrib/auth/middleware.py +++ b/django/contrib/auth/middleware.py @@ -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): |
