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
42563d9f
Commit
42563d9f
authored
Jan 11, 2012
by
Tom Christie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove explicit handling of 'OPTIONS' method, just raise the response, rather than returning it.
parent
ac512105
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
9 deletions
+6
-9
djangorestframework/views.py
+6
-9
No files found.
djangorestframework/views.py
View file @
42563d9f
...
@@ -119,7 +119,6 @@ class View(ResourceMixin, RequestMixin, ResponseMixin, AuthMixin, DjangoView):
...
@@ -119,7 +119,6 @@ class View(ResourceMixin, RequestMixin, ResponseMixin, AuthMixin, DjangoView):
"""
"""
self
.
headers
[
field
]
=
value
self
.
headers
[
field
]
=
value
# Note: session based authentication is explicitly CSRF validated,
# Note: session based authentication is explicitly CSRF validated,
# all other authentication is CSRF exempt.
# all other authentication is CSRF exempt.
@csrf_exempt
@csrf_exempt
...
@@ -153,13 +152,8 @@ class View(ResourceMixin, RequestMixin, ResponseMixin, AuthMixin, DjangoView):
...
@@ -153,13 +152,8 @@ class View(ResourceMixin, RequestMixin, ResponseMixin, AuthMixin, DjangoView):
else
:
else
:
response
=
Response
(
status
.
HTTP_204_NO_CONTENT
)
response
=
Response
(
status
.
HTTP_204_NO_CONTENT
)
if
request
.
method
==
'OPTIONS'
:
# Pre-serialize filtering (eg filter complex objects into natively serializable types)
# do not filter the response for HTTP OPTIONS, else the response fields are lost,
response
.
cleaned_content
=
self
.
filter_response
(
response
.
raw_content
)
# as they do not correspond with model fields
response
.
cleaned_content
=
response
.
raw_content
else
:
# Pre-serialize filtering (eg filter complex objects into natively serializable types)
response
.
cleaned_content
=
self
.
filter_response
(
response
.
raw_content
)
except
ErrorResponse
,
exc
:
except
ErrorResponse
,
exc
:
response
=
exc
.
response
response
=
exc
.
response
...
@@ -179,7 +173,10 @@ class View(ResourceMixin, RequestMixin, ResponseMixin, AuthMixin, DjangoView):
...
@@ -179,7 +173,10 @@ class View(ResourceMixin, RequestMixin, ResponseMixin, AuthMixin, DjangoView):
for
name
,
field
in
form
.
fields
.
iteritems
():
for
name
,
field
in
form
.
fields
.
iteritems
():
field_name_types
[
name
]
=
field
.
__class__
.
__name__
field_name_types
[
name
]
=
field
.
__class__
.
__name__
response_obj
[
'fields'
]
=
field_name_types
response_obj
[
'fields'
]
=
field_name_types
return
response_obj
# Note 'ErrorResponse' is misleading, it's just any response
# that should be rendered and returned immediately, without any
# response filtering.
raise
ErrorResponse
(
status
.
HTTP_200_OK
,
response_obj
)
class
ModelView
(
View
):
class
ModelView
(
View
):
...
...
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