handle NotFound

This commit is contained in:
Yun Xu 2017-06-09 08:33:34 -07:00
parent 3adb90071b
commit 4942af27dc

View File

@ -351,7 +351,10 @@ class Router:
:param request: Request object
:return: bool
"""
try:
handler = self.get(request)[0]
except NotFound:
return False
if (hasattr(handler, 'view_class') and
hasattr(handler.view_class, request.method.lower())):
handler = getattr(handler.view_class, request.method.lower())