Skip to content

Commit a804d0b

Browse files
committed
set the action when override_method regardless of its None-ness
1 parent ea1145c commit a804d0b

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

rest_framework/request.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,14 @@ def __init__(self, view, request, method):
4848

4949
def __enter__(self):
5050
self.view.request = clone_request(self.request, self.method)
51-
if self.action is not None:
52-
# For viewsets we also set the `.action` attribute.
53-
action_map = getattr(self.view, 'action_map', {})
54-
self.view.action = action_map.get(self.method.lower())
51+
# For viewsets we also set the `.action` attribute.
52+
action_map = getattr(self.view, 'action_map', {})
53+
self.view.action = action_map.get(self.method.lower())
5554
return self.view.request
5655

5756
def __exit__(self, *args, **kwarg):
5857
self.view.request = self.request
59-
if self.action is not None:
60-
self.view.action = self.action
58+
self.view.action = self.action
6159

6260

6361
class Empty(object):

0 commit comments

Comments
 (0)