forked from orbit-oss/flask
Make add_url_rule() signature consistent
This caused a mypy error when I was making another typing improvement, so I am fixing it before committing my other changes.
This commit is contained in:
parent
0d594b8c0f
commit
bf982718cf
2 changed files with 11 additions and 2 deletions
|
|
@ -365,6 +365,7 @@ class Blueprint(Scaffold):
|
||||||
rule: str,
|
rule: str,
|
||||||
endpoint: t.Optional[str] = None,
|
endpoint: t.Optional[str] = None,
|
||||||
view_func: t.Optional[t.Callable] = None,
|
view_func: t.Optional[t.Callable] = None,
|
||||||
|
provide_automatic_options: t.Optional[bool] = None,
|
||||||
**options: t.Any,
|
**options: t.Any,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Like :meth:`Flask.add_url_rule` but for a blueprint. The endpoint for
|
"""Like :meth:`Flask.add_url_rule` but for a blueprint. The endpoint for
|
||||||
|
|
@ -376,7 +377,15 @@ class Blueprint(Scaffold):
|
||||||
if view_func and hasattr(view_func, "__name__") and "." in view_func.__name__:
|
if view_func and hasattr(view_func, "__name__") and "." in view_func.__name__:
|
||||||
raise ValueError("'view_func' name may not contain a dot '.' character.")
|
raise ValueError("'view_func' name may not contain a dot '.' character.")
|
||||||
|
|
||||||
self.record(lambda s: s.add_url_rule(rule, endpoint, view_func, **options))
|
self.record(
|
||||||
|
lambda s: s.add_url_rule(
|
||||||
|
rule,
|
||||||
|
endpoint,
|
||||||
|
view_func,
|
||||||
|
provide_automatic_options=provide_automatic_options,
|
||||||
|
**options,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
def app_template_filter(self, name: t.Optional[str] = None) -> t.Callable:
|
def app_template_filter(self, name: t.Optional[str] = None) -> t.Callable:
|
||||||
"""Register a custom template filter, available application wide. Like
|
"""Register a custom template filter, available application wide. Like
|
||||||
|
|
|
||||||
|
|
@ -443,7 +443,7 @@ class Scaffold:
|
||||||
view_func: t.Optional[t.Callable] = None,
|
view_func: t.Optional[t.Callable] = None,
|
||||||
provide_automatic_options: t.Optional[bool] = None,
|
provide_automatic_options: t.Optional[bool] = None,
|
||||||
**options: t.Any,
|
**options: t.Any,
|
||||||
) -> t.Callable:
|
) -> None:
|
||||||
"""Register a rule for routing incoming requests and building
|
"""Register a rule for routing incoming requests and building
|
||||||
URLs. The :meth:`route` decorator is a shortcut to call this
|
URLs. The :meth:`route` decorator is a shortcut to call this
|
||||||
with the ``view_func`` argument. These are equivalent:
|
with the ``view_func`` argument. These are equivalent:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue