aboutsummaryrefslogtreecommitdiffstats
path: root/djangorestframework/authentication.py
diff options
context:
space:
mode:
authorSébastien Piquemal2012-02-23 22:47:45 +0200
committerSébastien Piquemal2012-02-23 22:47:45 +0200
commitafd490238a38c5445013f030547b1019f484f0bc (patch)
treed53ea67eae108c7c1d45aa52bb3f209155926349 /djangorestframework/authentication.py
parent9da1ae81dc9a056db94ea07f35478ed003fea598 (diff)
downloaddjango-rest-framework-afd490238a38c5445013f030547b1019f484f0bc.tar.bz2
authentication refactor : request.user + tests pass
Diffstat (limited to 'djangorestframework/authentication.py')
-rw-r--r--djangorestframework/authentication.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/djangorestframework/authentication.py b/djangorestframework/authentication.py
index e326c15a..00a61e3d 100644
--- a/djangorestframework/authentication.py
+++ b/djangorestframework/authentication.py
@@ -88,13 +88,14 @@ class UserLoggedInAuthentication(BaseAuthentication):
Otherwise returns :const:`None`.
"""
request.DATA # Make sure our generic parsing runs first
+ user = getattr(request.request, 'user', None)
- if getattr(request, 'user', None) and request.user.is_active:
+ if user and user.is_active:
# Enforce CSRF validation for session based authentication.
resp = CsrfViewMiddleware().process_view(request, None, (), {})
if resp is None: # csrf passed
- return request.user
+ return user
return None