Internal helper method to clone a request, replacing with a different HTTP method. Used for checking permissions against other methods.
(request, method)
| 91 | |
| 92 | |
| 93 | def clone_request(request, method): |
| 94 | """ |
| 95 | Internal helper method to clone a request, replacing with a different |
| 96 | HTTP method. Used for checking permissions against other methods. |
| 97 | """ |
| 98 | ret = Request(request=request._request, |
| 99 | parsers=request.parsers, |
| 100 | authenticators=request.authenticators, |
| 101 | negotiator=request.negotiator, |
| 102 | parser_context=request.parser_context) |
| 103 | ret._data = request._data |
| 104 | ret._files = request._files |
| 105 | ret._full_data = request._full_data |
| 106 | ret._content_type = request._content_type |
| 107 | ret._stream = request._stream |
| 108 | ret.method = method |
| 109 | if hasattr(request, '_user'): |
| 110 | ret._user = request._user |
| 111 | if hasattr(request, '_auth'): |
| 112 | ret._auth = request._auth |
| 113 | if hasattr(request, '_authenticator'): |
| 114 | ret._authenticator = request._authenticator |
| 115 | if hasattr(request, 'accepted_renderer'): |
| 116 | ret.accepted_renderer = request.accepted_renderer |
| 117 | if hasattr(request, 'accepted_media_type'): |
| 118 | ret.accepted_media_type = request.accepted_media_type |
| 119 | if hasattr(request, 'version'): |
| 120 | ret.version = request.version |
| 121 | if hasattr(request, 'versioning_scheme'): |
| 122 | ret.versioning_scheme = request.versioning_scheme |
| 123 | return ret |
| 124 | |
| 125 | |
| 126 | class ForcedAuthentication: |
no test coverage detected