Skip to content

Commit

Permalink
Decorates the proxy rather than the bound instance method
Browse files Browse the repository at this point in the history
  • Loading branch information
incognick committed May 12, 2016
1 parent 21dcb29 commit edaa910
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions flask_classful.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,6 @@ def make_proxy_method(cls, name):
i = cls()
view = getattr(i, name)

if cls.decorators:
for decorator in cls.decorators:
view = decorator(view)

@functools.wraps(view)
def proxy(**forgettable_view_args):
# Always use the global request object's view_args, because they
Expand Down Expand Up @@ -238,6 +234,11 @@ def proxy(**forgettable_view_args):

return response

# Decorate the proxy which is a function rather than the view which is a bound instance method
if cls.decorators:
for decorator in cls.decorators:
proxy = decorator(proxy)

return proxy

@classmethod
Expand Down

0 comments on commit edaa910

Please sign in to comment.