fix issue4297

This commit is contained in:
Rohan-Salwan 2021-10-19 07:48:54 +05:30
parent 225ff3ea6c
commit d42b80634f
2 changed files with 4 additions and 7 deletions

View file

@ -24,6 +24,8 @@ Released 2021-10-04
- Fix the order of ``before_request`` and other callbacks that trigger
before the view returns. They are called from the app down to the
closest nested blueprint. :issue:`4229`
- Fix ``Blueprint.errorhandler`` restricts type of result function which
avoids chaining. :issue:`4297`
Version 2.0.1

View file

@ -80,7 +80,7 @@ class Scaffold:
name: str
_static_folder: t.Optional[str] = None
_static_url_path: t.Optional[str] = None
T = t.TypeVar("T", t.Callable[..., t.Any], t.Any)
#: JSON encoder class used by :func:`flask.json.dumps`. If a
#: blueprint sets this, it will be used instead of the app's value.
json_encoder: t.Optional[t.Type[JSONEncoder]] = None
@ -646,12 +646,7 @@ class Scaffold:
return f
@setupmethod
def errorhandler(
self, code_or_exception: t.Union[t.Type[GenericException], int]
) -> t.Callable[
["ErrorHandlerCallable[GenericException]"],
"ErrorHandlerCallable[GenericException]",
]:
def errorhandler(self, code_or_exception: t.Union[T, int]) -> T:
"""Register a function to handle errors by code or exception class.
A decorator that is used to register a function given an