Skip to content
Myr

deprecate should_ignore_error

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 9b74a90 · Browse files · 3 files+27 added−9 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+27 added−9 removed

  • other:+27 added−9 removed

3 files+27 added−9 removed

modified:src/flask/sansio/app.py+9 added-8 removed
920 unmodified lines
921 return isinstance(e, BadRequest)922923 return False924925 def should_ignore_error(self, error: BaseException | None) -> bool:926 """This is called to figure out if an error should be ignored927 or not as far as the teardown system is concerned. If this928 function returns ``True`` then the teardown handlers will not be929 passed the error.925 should_ignore_error: None = None926 """If this method returns ``True``, the error will not be passed to927 teardown handlers, and the context will not be preserved for928 debugging.929931 .. versionadded:: 0.10932 """933 return False930 .. deprecated:: 3.2931 Handle errors as needed in teardown handlers instead.932933 .. versionadded:: 0.10934 """935936 def redirect(self, location: str, code: int = 303) -> BaseResponse:937 """Create a redirect response object.938939 This is called by :func:`flask.redirect`, and can be called
71 unmodified lines
modified:src/flask/app.py+16 added-1 removed
993 unmodified lines
994 error handling.995996 .. versionadded:: 0.7997 """998 if not self._got_first_request and self.should_ignore_error is not None:999 import warnings10001001 warnings.warn(1002 "The 'should_ignore_error' method is deprecated and will"1003 " be removed in Flask 3.3. Handle errors as needed in"1004 " teardown handlers instead.",1005 DeprecationWarning,1006 stacklevel=1,1007 )10081009 self._got_first_request = True10101011 try:1012 request_started.send(self, _async_wrapper=self.ensure_sync)
573 unmodified lines
1586 finally:1587 if "werkzeug.debug.preserve_context" in environ:1588 environ["werkzeug.debug.preserve_context"](ctx)15891579 if error is not None and self.should_ignore_error(error):1590 if (1591 error is not None1592 and self.should_ignore_error is not None1593 and self.should_ignore_error(error)1594 ):1595 error = None15961597 ctx.pop(error)1598
8 unmodified lines
modified:CHANGES.rst+2 added
12 unmodified lines
13 ``AppContext`` as the first parameter, instead of using the proxy objects.14 If subclasses were overriding these methods, the old signature is detected,15 shows a deprecation warning, and will continue to work during the16 deprecation period. :issue:`5815`17- The ``should_ignore_error`` is deprecated. Handle errors as needed in18 teardown handlers instead. :issue:`5816`19- ``template_filter``, ``template_test``, and ``template_global`` decorators20 can be used without parentheses. :issue:`5729`21- ``redirect`` returns a ``303`` status code by default instead of ``302``.22 This tells the client to always switch to ``GET``, rather than only
1629 unmodified lines