handle NotFound

This commit is contained in:
Yun Xu 2017-06-09 08:33:34 -07:00
parent 2352412213
commit deb0b487de

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())