From ed04725822d5dc9a90c9c6e5c14d85083ae6ff28 Mon Sep 17 00:00:00 2001 From: Brandon Cazander Date: Sat, 24 Jan 2015 01:44:40 -0800 Subject: Use enhanced request when cloning requests for checking permissions on other methods. Fixes #2455 --- rest_framework/request.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'rest_framework') diff --git a/rest_framework/request.py b/rest_framework/request.py index cfbbdecc..d5b56ada 100644 --- a/rest_framework/request.py +++ b/rest_framework/request.py @@ -86,7 +86,7 @@ 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, + ret = Request(request=request, parsers=request.parsers, authenticators=request.authenticators, negotiator=request.negotiator, -- cgit v1.2.3 From bf58c1265ddf06deb435d049fae01ed324a310e0 Mon Sep 17 00:00:00 2001 From: Brandon Cazander Date: Mon, 26 Jan 2015 22:56:57 -0800 Subject: Set a version attribute on cloned requests if necessary. --- rest_framework/request.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'rest_framework') diff --git a/rest_framework/request.py b/rest_framework/request.py index d5b56ada..ce2fcb47 100644 --- a/rest_framework/request.py +++ b/rest_framework/request.py @@ -86,7 +86,7 @@ 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, + ret = Request(request=request._request, parsers=request.parsers, authenticators=request.authenticators, negotiator=request.negotiator, @@ -107,6 +107,8 @@ def clone_request(request, method): ret.accepted_renderer = request.accepted_renderer if hasattr(request, 'accepted_media_type'): ret.accepted_media_type = request.accepted_media_type + if hasattr(request, 'version'): + ret.version = request.version return ret -- cgit v1.2.3