From bf982718cf30615f2dd17fa71fe17d565ebb1d3e Mon Sep 17 00:00:00 2001 From: Alex Hedges Date: Sat, 15 May 2021 17:38:25 -0400 Subject: [PATCH] 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. --- src/flask/blueprints.py | 11 ++++++++++- src/flask/scaffold.py | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/flask/blueprints.py b/src/flask/blueprints.py index 39396ce7..098eca8c 100644 --- a/src/flask/blueprints.py +++ b/src/flask/blueprints.py @@ -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 diff --git a/src/flask/scaffold.py b/src/flask/scaffold.py index f50c9b1b..20654b6b 100644 --- a/src/flask/scaffold.py +++ b/src/flask/scaffold.py @@ -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: