Do not handle RoutingExceptions with app error handlers

This commit is contained in:
Jimmy Jia 2018-11-01 16:41:53 -04:00 committed by David Lord
parent 38a391815b
commit b92b2e6c74
No known key found for this signature in database
GPG key ID: 7A1C87E3F5BC42A8
2 changed files with 13 additions and 1 deletions

View file

@ -20,7 +20,8 @@ from threading import Lock
from werkzeug.datastructures import Headers, ImmutableDict
from werkzeug.exceptions import BadRequest, BadRequestKeyError, HTTPException, \
InternalServerError, MethodNotAllowed, default_exceptions
from werkzeug.routing import BuildError, Map, RequestRedirect, Rule
from werkzeug.routing import BuildError, Map, RequestRedirect, \
RoutingException, Rule
from . import cli, json
from ._compat import integer_types, reraise, string_types, text_type
@ -1638,6 +1639,12 @@ class Flask(_PackageBoundObject):
if e.code is None:
return e
# RoutingExceptions such as RequestRedirects are special exceptions
# used to trigger routing actions such as redirects, and also behave
# like proxy exceptions. We return these unchanged as well.
if isinstance(e, RoutingException):
return e
handler = self._find_error_handler(e)
if handler is None:
return e