Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-rest-framework
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
django-rest-framework
Commits
85c96bb5
Commit
85c96bb5
authored
Nov 28, 2014
by
Martin Maillard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set user on wrapped request
parent
caf1de3b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
rest_framework/request.py
+6
-3
No files found.
rest_framework/request.py
View file @
85c96bb5
...
@@ -277,8 +277,11 @@ class Request(object):
...
@@ -277,8 +277,11 @@ class Request(object):
Sets the user on the current request. This is necessary to maintain
Sets the user on the current request. This is necessary to maintain
compatibility with django.contrib.auth where the user property is
compatibility with django.contrib.auth where the user property is
set in the login and logout functions.
set in the login and logout functions.
Sets the user on the wrapped original request as well.
"""
"""
self
.
_user
=
value
self
.
_user
=
value
self
.
_request
.
user
=
value
@property
@property
def
auth
(
self
):
def
auth
(
self
):
...
@@ -456,7 +459,7 @@ class Request(object):
...
@@ -456,7 +459,7 @@ class Request(object):
if
user_auth_tuple
is
not
None
:
if
user_auth_tuple
is
not
None
:
self
.
_authenticator
=
authenticator
self
.
_authenticator
=
authenticator
self
.
_
user
,
self
.
_auth
=
user_auth_tuple
self
.
user
,
self
.
_auth
=
user_auth_tuple
return
return
self
.
_not_authenticated
()
self
.
_not_authenticated
()
...
@@ -471,9 +474,9 @@ class Request(object):
...
@@ -471,9 +474,9 @@ class Request(object):
self
.
_authenticator
=
None
self
.
_authenticator
=
None
if
api_settings
.
UNAUTHENTICATED_USER
:
if
api_settings
.
UNAUTHENTICATED_USER
:
self
.
_
user
=
api_settings
.
UNAUTHENTICATED_USER
()
self
.
user
=
api_settings
.
UNAUTHENTICATED_USER
()
else
:
else
:
self
.
_
user
=
None
self
.
user
=
None
if
api_settings
.
UNAUTHENTICATED_TOKEN
:
if
api_settings
.
UNAUTHENTICATED_TOKEN
:
self
.
_auth
=
api_settings
.
UNAUTHENTICATED_TOKEN
()
self
.
_auth
=
api_settings
.
UNAUTHENTICATED_TOKEN
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment