add changelog for GH-2986
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by David Lord · committed by David Lord · parent b92b2e6 · Browse files · 3 files·+22 added−8 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
3 files+22 added−8 removed
- tests:+4 added−5 removed
- other:+18 added−3 removed
Provenance
- Commit
662ce21- Tree
85b74e7- Author
David Lord <davidism@gmail.com>- Committer
David Lord <davidism@gmail.com>- Parent
b92b2e6
3 files changed+22 added−8 removed
modified:flask/app.py+13 added-3 removed
1630 unmodified lines1631 """Handles an HTTP exception. By default this will invoke the1632 registered error handlers and fall back to returning the1633 exception as response.1634 1635+ .. versionchanged:: 1.0.31636+ ``RoutingException``, used internally for actions such as1637+ slash redirects during routing, is not passed to error1638+ handlers.1639+1640+ .. versionchanged:: 1.01641+ Exceptions are looked up by code *and* by MRO, so1642+ ``HTTPExcpetion`` subclasses can be handled with a catch-all1643+ handler for the base ``HTTPException``.1644+1645 .. versionadded:: 0.31646 """1647 # Proxy exceptions don't have error codes. We want to always return1648 # those unchanged as errors1649 if e.code is None:1650 return e1651 1642- # RoutingExceptions such as RequestRedirects are special exceptions1643- # used to trigger routing actions such as redirects, and also behave1644- # like proxy exceptions. We return these unchanged as well.1652+ # RoutingExceptions are used internally to trigger routing1653+ # actions, such as slash redirects raising RequestRedirect. They1654+ # are not raised or handled in user code.1655 if isinstance(e, RoutingException):1656 return e1657 1658 handler = self._find_error_handler(e)676 unmodified linesmodified:tests/test_user_error_handler.py+4 added-5 removed
182 unmodified lines183 @app.route('/forbidden')184 def forbidden():185 raise Forbidden()186 187- @app.route('/slash/')187+ @app.route("/slash/")188 def slash():189- return ''189+ return "slash"190 191 app.register_blueprint(bp, url_prefix='/bp')192 193 c = app.test_client()194 assert c.get('/bp/undefined').data == b'bp-default'195 assert c.get('/bp/forbidden').data == b'bp-forbidden'196 assert c.get('/undefined').data == b'default'197 assert c.get('/forbidden').data == b'forbidden'198- assert c.get('/slash').location.endswith('/slash/')199-200-198+ # Don't handle RequestRedirect raised when adding slash.199+ assert c.get("/slash", follow_redirects=True).data == b"slash"modified:CHANGES.rst+5 added
17 unmodified lines18 - ``flask --version`` outputs Werkzeug's version and simplifies the19 Python version. (`#2825`_)20 - :func:`send_file` handles an ``attachment_filename`` that is a21 native Python 2 string (bytes) with UTF-8 coded bytes. (`#2933`_)22+- A catch-all error handler registered for ``HTTPException`` will not23+ handle ``RoutingExcpetion``, which is used internally during24+ routing. This fixes the unexpected behavior that had been introduced25+ in 1.0. (`#2986`_)26 27 .. _#2766: https://github.com/pallets/flask/issues/276628 .. _#2765: https://github.com/pallets/flask/pull/276529 .. _#2825: https://github.com/pallets/flask/pull/282530 .. _#2933: https://github.com/pallets/flask/issues/293331+.. _#2986: https://github.com/pallets/flask/pull/298632 33 34 Version 1.0.235 -------------896 unmodified lines