Skip to content
Myr

Merge pull request #3272 from pallets/keyerror

Before adoption: this commit came in with the history the project adopted, so no landing records it.

don't clear BadRequestKeyError args

authored by David Lord · committed by GitHub · parents 31d3c7e, 871e6d6 · Browse files · 3 files+16 added−6 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+16 added−6 removed

  • other:+16 added−6 removed

3 files+16 added−6 removed

modified:flask/__init__.py+1 added-1 removed
8 unmodified lines
9 :copyright: 2010 Pallets10 :license: BSD-3-Clause11"""1213__version__ = '1.0.3'13__version__ = '1.0.4.dev'1415# utilities we import from Werkzeug and Jinja2 that are unused16# in the module but are exported as public interface.17from werkzeug.exceptions import abort
32 unmodified lines
modified:flask/app.py+5 added-5 removed
1722 unmodified lines
1723 # trap_http_exception method so that's their fault then.17241725 if isinstance(e, BadRequestKeyError):1726 if self.debug or self.config["TRAP_BAD_REQUEST_ERRORS"]:1727 e.show_exception = True17281729 # Werkzeug < 0.15 doesn't add the KeyError to the 4001730 # message, add it in manually.1729 description = e.get_description()17301731 if e.args[0] not in description:1731 # TODO: clean up once Werkzeug >= 0.15.5 is required1732 if e.args[0] not in e.get_description():1733 e.description = "KeyError: '{}'".format(*e.args)1733 else:1734 # Werkzeug >= 0.15 does add it, remove it in production1734 elif not hasattr(BadRequestKeyError, "show_exception"):1735 e.args = ()17361737 if isinstance(e, HTTPException) and not self.trap_http_exception(e):1738 return self.handle_http_exception(e)
602 unmodified lines
modified:CHANGES.rst+10 added
1.. currentmodule:: flask23Version 1.0.44-------------56Unreleased78- The key information for ``BadRequestKeyError`` is no longer cleared9 outside debug mode, so error handlers can still access it. This10 requires upgrading to Werkzeug 0.15.5. :issue:`3249`111213Version 1.0.314-------------1516Released 2019-05-17
879 unmodified lines