forked from orbit-oss/flask
Merge branch '2.1.x'
This commit is contained in:
commit
7a2d5fb6df
11 changed files with 203 additions and 64 deletions
|
|
@ -392,7 +392,7 @@ class Blueprint(Scaffold):
|
|||
self,
|
||||
rule: str,
|
||||
endpoint: t.Optional[str] = None,
|
||||
view_func: t.Optional[t.Callable] = None,
|
||||
view_func: t.Optional[ft.ViewCallable] = None,
|
||||
provide_automatic_options: t.Optional[bool] = None,
|
||||
**options: t.Any,
|
||||
) -> None:
|
||||
|
|
@ -580,12 +580,14 @@ class Blueprint(Scaffold):
|
|||
return f
|
||||
|
||||
@setupmethod
|
||||
def app_errorhandler(self, code: t.Union[t.Type[Exception], int]) -> t.Callable:
|
||||
def app_errorhandler(
|
||||
self, code: t.Union[t.Type[Exception], int]
|
||||
) -> t.Callable[[ft.ErrorHandlerDecorator], ft.ErrorHandlerDecorator]:
|
||||
"""Like :meth:`Flask.errorhandler` but for a blueprint. This
|
||||
handler is used for all requests, even if outside of the blueprint.
|
||||
"""
|
||||
|
||||
def decorator(f: ft.ErrorHandlerCallable) -> ft.ErrorHandlerCallable:
|
||||
def decorator(f: ft.ErrorHandlerDecorator) -> ft.ErrorHandlerDecorator:
|
||||
self.record_once(lambda s: s.app.errorhandler(code)(f))
|
||||
return f
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue