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
84f77580
Commit
84f77580
authored
Sep 28, 2012
by
Tom Christie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove support for doctests
parent
aeeb68f6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
7 deletions
+18
-7
rest_framework/renderers.py
+2
-5
rest_framework/request.py
+16
-0
rest_framework/tests/__init__.py
+0
-2
No files found.
rest_framework/renderers.py
View file @
84f77580
...
@@ -5,13 +5,13 @@ Django REST framework also provides HTML and PlainText renderers that help self-
...
@@ -5,13 +5,13 @@ Django REST framework also provides HTML and PlainText renderers that help self-
by serializing the output along with documentation regarding the View, output status and headers,
by serializing the output along with documentation regarding the View, output status and headers,
and providing forms and links depending on the allowed methods, renderers and parsers on the View.
and providing forms and links depending on the allowed methods, renderers and parsers on the View.
"""
"""
import
copy
import
string
import
string
from
django
import
forms
from
django
import
forms
from
django.template
import
RequestContext
,
loader
from
django.template
import
RequestContext
,
loader
from
django.utils
import
simplejson
as
json
from
django.utils
import
simplejson
as
json
from
rest_framework.compat
import
yaml
from
rest_framework.compat
import
yaml
from
rest_framework.settings
import
api_settings
from
rest_framework.settings
import
api_settings
from
rest_framework.request
import
clone_request
from
rest_framework.utils
import
dict2xml
from
rest_framework.utils
import
dict2xml
from
rest_framework.utils
import
encoders
from
rest_framework.utils
import
encoders
from
rest_framework.utils.breadcrumbs
import
get_breadcrumbs
from
rest_framework.utils.breadcrumbs
import
get_breadcrumbs
...
@@ -227,12 +227,9 @@ class DocumentingHTMLRenderer(BaseRenderer):
...
@@ -227,12 +227,9 @@ class DocumentingHTMLRenderer(BaseRenderer):
if
not
api_settings
.
FORM_METHOD_OVERRIDE
:
if
not
api_settings
.
FORM_METHOD_OVERRIDE
:
return
# Cannot use form overloading
return
# Cannot use form overloading
temp
=
request
.
_method
request
=
clone_request
(
request
,
method
)
request
.
_method
=
method
.
upper
()
if
not
view
.
has_permission
(
request
):
if
not
view
.
has_permission
(
request
):
request
.
_method
=
temp
return
# Don't have permission
return
# Don't have permission
request
.
_method
=
temp
if
method
==
'DELETE'
or
method
==
'OPTIONS'
:
if
method
==
'DELETE'
or
method
==
'OPTIONS'
:
return
True
# Don't actually need to return a form
return
True
# Don't actually need to return a form
...
...
rest_framework/request.py
View file @
84f77580
...
@@ -28,6 +28,22 @@ def _hasattr(obj, name):
...
@@ -28,6 +28,22 @@ def _hasattr(obj, name):
return
not
getattr
(
obj
,
name
)
is
Empty
return
not
getattr
(
obj
,
name
)
is
Empty
def
clone_request
(
request
,
method
):
"""
Internal helper method to clone a request, replacing with a different
HTTP method. Used for checking permissions against other methods.
"""
ret
=
Request
(
request
.
_request
,
request
.
parser_classes
,
request
.
authentication_classes
)
ret
.
_data
=
request
.
_data
ret
.
_files
=
request
.
_files
ret
.
_content_type
=
request
.
_content_type
ret
.
_stream
=
request
.
_stream
ret
.
_method
=
method
return
ret
class
Request
(
object
):
class
Request
(
object
):
"""
"""
Wrapper allowing to enhance a standard `HttpRequest` instance.
Wrapper allowing to enhance a standard `HttpRequest` instance.
...
...
rest_framework/tests/__init__.py
View file @
84f77580
...
@@ -7,6 +7,4 @@ modules = [filename.rsplit('.', 1)[0]
...
@@ -7,6 +7,4 @@ modules = [filename.rsplit('.', 1)[0]
__test__
=
dict
()
__test__
=
dict
()
for
module
in
modules
:
for
module
in
modules
:
exec
(
"from rest_framework.tests.
%
s import __doc__ as module_doc"
%
module
)
exec
(
"from rest_framework.tests.
%
s import *"
%
module
)
exec
(
"from rest_framework.tests.
%
s import *"
%
module
)
__test__
[
module
]
=
module_doc
or
""
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