aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework
diff options
context:
space:
mode:
authorTom Christie2014-09-24 09:03:41 +0100
committerTom Christie2014-09-24 09:03:41 +0100
commit411511622d163ad81720651869b80dc9de526d65 (patch)
treee578c0a615781b3c33bf14044d5824eadb50b834 /rest_framework
parent4ffae7c0e959e42fa2dde830ac144e94ee8aae71 (diff)
parent90139b3efc7da7a2c396882b6905291269387ace (diff)
downloaddjango-rest-framework-411511622d163ad81720651869b80dc9de526d65.tar.bz2
Merge pull request #1900 from jpadilla/pr_1507
Correctly propagate cloned_request for OPTIONS
Diffstat (limited to 'rest_framework')
-rw-r--r--rest_framework/generics.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/rest_framework/generics.py b/rest_framework/generics.py
index a6f68657..a62da00b 100644
--- a/rest_framework/generics.py
+++ b/rest_framework/generics.py
@@ -398,10 +398,11 @@ class GenericAPIView(views.APIView):
if method not in self.allowed_methods:
continue
- cloned_request = clone_request(request, method)
+ original_request = self.request
+ self.request = clone_request(request, method)
try:
# Test global permissions
- self.check_permissions(cloned_request)
+ self.check_permissions(self.request)
# Test object permissions
if method == 'PUT':
try:
@@ -419,6 +420,8 @@ class GenericAPIView(views.APIView):
# appropriate metadata about the fields that should be supplied.
serializer = self.get_serializer()
actions[method] = serializer.metadata()
+ finally:
+ self.request = original_request
if actions:
ret['actions'] = actions