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
166292f6
Commit
166292f6
authored
Dec 21, 2012
by
Tom Christie
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #528 from mhsparks/master
Added setter to auth property
parents
c27295dc
125f027d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
+16
-0
rest_framework/request.py
+8
-0
rest_framework/tests/request.py
+8
-0
No files found.
rest_framework/request.py
View file @
166292f6
...
...
@@ -188,6 +188,14 @@ class Request(object):
self
.
_user
,
self
.
_auth
=
self
.
_authenticate
()
return
self
.
_auth
@auth.setter
def
auth
(
self
,
value
):
"""
Sets any non-user authentication information associated with the
request, such as an authentication token.
"""
self
.
_auth
=
value
def
_load_data_and_files
(
self
):
"""
Parses the request content into self.DATA and self.FILES.
...
...
rest_framework/tests/request.py
View file @
166292f6
...
...
@@ -303,3 +303,11 @@ class TestUserSetter(TestCase):
self
.
assertFalse
(
self
.
request
.
user
.
is_anonymous
())
logout
(
self
.
request
)
self
.
assertTrue
(
self
.
request
.
user
.
is_anonymous
())
class
TestAuthSetter
(
TestCase
):
def
test_auth_can_be_set
(
self
):
request
=
Request
(
factory
.
get
(
'/'
))
request
.
auth
=
'DUMMY'
self
.
assertEqual
(
request
.
auth
,
'DUMMY'
)
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