Merge pull request #1763 from fongandrew/patch-1

override_method should substitute action
This commit is contained in:
Tom Christie 2014-08-18 20:39:09 +01:00
commit 01986fc80e

View File

@ -42,12 +42,16 @@ class override_method(object):
self.view = view
self.request = request
self.method = method
self.action = getattr(view, 'action', None)
def __enter__(self):
self.view.request = clone_request(self.request, self.method)
action_map = getattr(self.view, 'action_map', {})
self.view.action = action_map.get(self.method.lower())
return self.view.request
def __exit__(self, *args, **kwarg):
self.view.action = self.action
self.view.request = self.request