reject unnamed handlers

This commit is contained in:
Suby Raman 2017-02-03 10:12:33 -05:00
parent aa54785918
commit 36d519026f

View File

@ -196,7 +196,7 @@ class Router:
handler_name = '{}.{}'.format(
handler.__blueprintname__, handler.__name__)
else:
handler_name = handler.__name__
handler_name = getattr(handler, '__name__', None)
route = Route(
handler=handler, methods=methods, pattern=pattern,
@ -245,6 +245,9 @@ class Router:
:param view_name: string of view name to search by
:return: tuple containing (uri, Route)
"""
if not view_name:
return (None, None)
for uri, route in self.routes_all.items():
if route.name == view_name:
return uri, route