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
23289b02
Commit
23289b02
authored
Apr 16, 2013
by
Tom Christie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Explicit error if dev does not return a response from the view
parent
0c1b8b4f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletions
+7
-1
rest_framework/views.py
+7
-1
No files found.
rest_framework/views.py
View file @
23289b02
...
@@ -3,7 +3,7 @@ Provides an APIView class that is used as the base of all class-based views.
...
@@ -3,7 +3,7 @@ Provides an APIView class that is used as the base of all class-based views.
"""
"""
from
__future__
import
unicode_literals
from
__future__
import
unicode_literals
from
django.core.exceptions
import
PermissionDenied
from
django.core.exceptions
import
PermissionDenied
from
django.http
import
Http404
from
django.http
import
Http404
,
HttpResponse
from
django.utils.html
import
escape
from
django.utils.html
import
escape
from
django.utils.safestring
import
mark_safe
from
django.utils.safestring
import
mark_safe
from
django.views.decorators.csrf
import
csrf_exempt
from
django.views.decorators.csrf
import
csrf_exempt
...
@@ -327,6 +327,12 @@ class APIView(View):
...
@@ -327,6 +327,12 @@ class APIView(View):
"""
"""
Returns the final response object.
Returns the final response object.
"""
"""
# Make the error obvious if a proper response is not returned
assert
isinstance
(
response
,
HttpResponse
),
(
'Expected a `Response` to be returned from the view, '
'but received a `
%
s`'
%
type
(
response
)
)
if
isinstance
(
response
,
Response
):
if
isinstance
(
response
,
Response
):
if
not
getattr
(
request
,
'accepted_renderer'
,
None
):
if
not
getattr
(
request
,
'accepted_renderer'
,
None
):
neg
=
self
.
perform_content_negotiation
(
request
,
force
=
True
)
neg
=
self
.
perform_content_negotiation
(
request
,
force
=
True
)
...
...
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