Skip to content

Commit 5d9612b

Browse files
committed
remove class name restrictions for class routing
1 parent 3cdda39 commit 5d9612b

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

app/core/blueprint.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -89,20 +89,19 @@ def model_add_router(self, mod):
8989
if hasattr(mod, '__routes__'):
9090
for route in mod.__routes__:
9191
if inspect.isclass(route[2]):
92-
if route[2].__name__ == "Methods":
93-
""" If it's a class it needs to extract the methods by function names
94-
magic functions are excluded
95-
"""
96-
route_name, slug, cls = route
97-
for (fn_name, fn_object) in self.get_cls_fn_members(cls):
98-
if inspect.isfunction(fn_object):
99-
mod.__method__.add_url_rule(
100-
rule=slug,
101-
endpoint=fn_name,
102-
view_func=fn_object,
103-
methods=self.get_http_methods([fn_name]))
104-
else:
105-
raise KeyError("Member is not a function.")
92+
""" If it's a class it needs to extract the methods by function names
93+
magic functions are excluded
94+
"""
95+
route_name, slug, cls = route
96+
for (fn_name, fn_object) in self.get_cls_fn_members(cls):
97+
if inspect.isfunction(fn_object):
98+
mod.__method__.add_url_rule(
99+
rule=slug,
100+
endpoint=fn_name,
101+
view_func=fn_object,
102+
methods=self.get_http_methods([fn_name]))
103+
else:
104+
raise KeyError("Member is not a function.")
106105

107106
elif inspect.isfunction(route[2]):
108107
route_name, slug, fn, methods = route

0 commit comments

Comments
 (0)