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:
Alex Hedges 2021-05-15 17:38:25 -04:00 committed by Phil Jones
parent 0d594b8c0f
commit bf982718cf
2 changed files with 11 additions and 2 deletions

View file

@ -365,6 +365,7 @@ class Blueprint(Scaffold):
rule: str,
endpoint: t.Optional[str] = None,
view_func: t.Optional[t.Callable] = None,
provide_automatic_options: t.Optional[bool] = None,
**options: t.Any,
) -> None:
"""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__:
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:
"""Register a custom template filter, available application wide. Like

View file

@ -443,7 +443,7 @@ class Scaffold:
view_func: t.Optional[t.Callable] = None,
provide_automatic_options: t.Optional[bool] = None,
**options: t.Any,
) -> t.Callable:
) -> None:
"""Register a rule for routing incoming requests and building
URLs. The :meth:`route` decorator is a shortcut to call this
with the ``view_func`` argument. These are equivalent: