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
This commit is contained in:
parent
086992c739
commit
3c5782287e
|
@ -1,12 +1,9 @@
|
||||||
class LazyUser(object):
|
class LazyUser(object):
|
||||||
def __init__(self):
|
|
||||||
self._user = None
|
|
||||||
|
|
||||||
def __get__(self, request, obj_type=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
|
from django.contrib.auth import get_user
|
||||||
self._user = get_user(request)
|
request._cached_user = get_user(request)
|
||||||
return self._user
|
return request._cached_user
|
||||||
|
|
||||||
class AuthenticationMiddleware(object):
|
class AuthenticationMiddleware(object):
|
||||||
def process_request(self, request):
|
def process_request(self, request):
|
||||||
|
|
Loading…
Reference in New Issue