aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/request.py
diff options
context:
space:
mode:
authorTom Christie2012-09-28 11:53:51 +0100
committerTom Christie2012-09-28 11:53:51 +0100
commit84f775803994ccd82671dd4a6f9b4d87aa36dc31 (patch)
treea28f8213f0ebce048b163d79d5c3e182b3f20171 /rest_framework/request.py
parentaeeb68f68a8f5a3deb9f1ad06f11dbbd9a8f1ff6 (diff)
downloaddjango-rest-framework-84f775803994ccd82671dd4a6f9b4d87aa36dc31.tar.bz2
Remove support for doctests
Diffstat (limited to 'rest_framework/request.py')
-rw-r--r--rest_framework/request.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/rest_framework/request.py b/rest_framework/request.py
index 2034ccc6..e254cf8e 100644
--- a/rest_framework/request.py
+++ b/rest_framework/request.py
@@ -28,6 +28,22 @@ def _hasattr(obj, name):
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):
"""
Wrapper allowing to enhance a standard `HttpRequest` instance.