mirror of https://github.com/pallets/flask.git
add changelog for GH-2986
This commit is contained in:
parent
b92b2e6c74
commit
662ce2151d
|
@ -19,11 +19,16 @@ Unreleased
|
|||
Python version. (`#2825`_)
|
||||
- :func:`send_file` handles an ``attachment_filename`` that is a
|
||||
native Python 2 string (bytes) with UTF-8 coded bytes. (`#2933`_)
|
||||
- A catch-all error handler registered for ``HTTPException`` will not
|
||||
handle ``RoutingExcpetion``, which is used internally during
|
||||
routing. This fixes the unexpected behavior that had been introduced
|
||||
in 1.0. (`#2986`_)
|
||||
|
||||
.. _#2766: https://github.com/pallets/flask/issues/2766
|
||||
.. _#2765: https://github.com/pallets/flask/pull/2765
|
||||
.. _#2825: https://github.com/pallets/flask/pull/2825
|
||||
.. _#2933: https://github.com/pallets/flask/issues/2933
|
||||
.. _#2986: https://github.com/pallets/flask/pull/2986
|
||||
|
||||
|
||||
Version 1.0.2
|
||||
|
|
16
flask/app.py
16
flask/app.py
|
@ -1632,6 +1632,16 @@ class Flask(_PackageBoundObject):
|
|||
registered error handlers and fall back to returning the
|
||||
exception as response.
|
||||
|
||||
.. versionchanged:: 1.0.3
|
||||
``RoutingException``, used internally for actions such as
|
||||
slash redirects during routing, is not passed to error
|
||||
handlers.
|
||||
|
||||
.. versionchanged:: 1.0
|
||||
Exceptions are looked up by code *and* by MRO, so
|
||||
``HTTPExcpetion`` subclasses can be handled with a catch-all
|
||||
handler for the base ``HTTPException``.
|
||||
|
||||
.. versionadded:: 0.3
|
||||
"""
|
||||
# Proxy exceptions don't have error codes. We want to always return
|
||||
|
@ -1639,9 +1649,9 @@ 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.
|
||||
# RoutingExceptions are used internally to trigger routing
|
||||
# actions, such as slash redirects raising RequestRedirect. They
|
||||
# are not raised or handled in user code.
|
||||
if isinstance(e, RoutingException):
|
||||
return e
|
||||
|
||||
|
|
|
@ -184,9 +184,9 @@ def test_default_error_handler():
|
|||
def forbidden():
|
||||
raise Forbidden()
|
||||
|
||||
@app.route('/slash/')
|
||||
@app.route("/slash/")
|
||||
def slash():
|
||||
return ''
|
||||
return "slash"
|
||||
|
||||
app.register_blueprint(bp, url_prefix='/bp')
|
||||
|
||||
|
@ -195,6 +195,5 @@ def test_default_error_handler():
|
|||
assert c.get('/bp/forbidden').data == b'bp-forbidden'
|
||||
assert c.get('/undefined').data == b'default'
|
||||
assert c.get('/forbidden').data == b'forbidden'
|
||||
assert c.get('/slash').location.endswith('/slash/')
|
||||
|
||||
|
||||
# Don't handle RequestRedirect raised when adding slash.
|
||||
assert c.get("/slash", follow_redirects=True).data == b"slash"
|
||||
|
|
Loading…
Reference in New Issue