Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions flask_classy.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def build_rule(cls, rule, method=None):
ignored_rule_args += cls.base_args

if method:
args = get_true_argspec(method)[0]
args = get_true_argspec(method, method.__name__)[0]
for arg in args:
if arg not in ignored_rule_args:
rule_parts.append("<%s>" % arg)
Expand Down Expand Up @@ -291,7 +291,7 @@ def get_interesting_members(base_class, cls):
and not member[0].startswith("after_")]


def get_true_argspec(method):
def get_true_argspec(method, raw_method_name=None):
"""Drills through layers of decorators attempting to locate the actual argspec for the method."""

argspec = inspect.getargspec(method)
Expand All @@ -301,6 +301,8 @@ def get_true_argspec(method):
if hasattr(method, '__func__'):
method = method.__func__
if not hasattr(method, '__closure__') or method.__closure__ is None:
if method.__name__ != raw_method_name:
return
raise DecoratorCompatibilityError

closure = method.__closure__
Expand All @@ -311,7 +313,7 @@ def get_true_argspec(method):
if not inspect.isfunction(inner_method) \
and not inspect.ismethod(inner_method):
continue
true_argspec = get_true_argspec(inner_method)
true_argspec = get_true_argspec(inner_method, raw_method_name)
if true_argspec:
return true_argspec

Expand Down