Flask-RESTful will fail when Flask deprecates propagate_exceptions: Fix #962
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Handle the deprecation of Flask's propagate_exceptions
Overview of the Issue in Flask-RESTful
Flasks
app.propagate_exceptions
will be deprecated in the next release, and although the Flask developers don't have a release date, given their release history it may be sooner rather than later. If it is deprecated Flask-RESTful will throw an exception inflask_restul.__init__
in the handle_errors method. This is the only place in Flask-RESTful where thisattribute is accessed.
This pull request addresses the need to fix this issue in Flask-RESTful. Along with the fix I cleaned up that area of the code a bit, and made a few minor style changes, e.g., fixing a typo, removing an extra line feed, etc. Unit tests were added and pass.
Currently in Flask, if
app.propagate_exceptions
is set to True then the exceptions are re-raised rather than being handled by the app’s error handlers. Whenapp.propagate_exceptions
is deprecatedapp.config['PROPAGATE_EXCEPTIONS']
may be used in its place. Additionally, ifapp.propagate_exceptions
is None (default value), then a sensible value should be substituted.Relevant Flask Documentation
Flask Config Docs
Relevant Flask Pull Requests
#4716: deprecate most config attributes (fixed by #4722)
#4722: deprecate most config attributes (merged)