Skip to content

Commit

Permalink
0.95-bugfixes: Apply fix to LazyUser from [3754]
Browse files Browse the repository at this point in the history
git-svn-id: http://code.djangoproject.com/svn/django/branches/0.95-bugfixes@4361 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
ubernostrum committed Jan 20, 2007
1 parent a132d41 commit e89f0a6
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions 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):
Expand Down

0 comments on commit e89f0a6

Please sign in to comment.