Method: flask.blueprints.Blueprint.add_url_rule
Calls: 70, Exceptions: 3, Paths: 3Back
Path 1: 67 calls (0.96)
'/' (23) '/error' (9) '/bar' (6) '' (3) '/no' (3) '/foo' (2) '/bp' (2) '/
None (65) 'bar' (1) '123' (1)
test_blueprint_prefix_slash.
None (67)
{} (55) dict (12)
1@setupmethod
2 def add_url_rule(
3 self,
4 rule: str,
5 endpoint: str | None = None,
6 view_func: ft.RouteCallable | None = None,
7 provide_automatic_options: bool | None = None,
8 **options: t.Any,
9 ) -> None:
10 """Register a URL rule with the blueprint. See :meth:`.Flask.add_url_rule` for
11 full documentation.
12
13 The URL rule is prefixed with the blueprint's URL prefix. The endpoint name,
14 used with :func:`url_for`, is prefixed with the blueprint's name.
15 """
16 if endpoint and "." in endpoint:
17 raise ValueError("'endpoint' may not contain a dot '.' character.")
18
19 if view_func and hasattr(view_func, "__name__") and "." in view_func.__name__:
20 raise ValueError("'view_func' name may not contain a dot '.' character.")
21
22 self.record(
23 lambda s: s.add_url_rule(
24 rule,
25 endpoint,
26 view_func,
27 provide_automatic_options=provide_automatic_options,
28 **options,
29 )
30 )
Path 2: 2 calls (0.03)
'/' (2)
'a.b' (2)
test_route_decorator_custom_endpoint_with_dots.
None (2)
{} (2)
ValueError (2)
1@setupmethod
2 def add_url_rule(
3 self,
4 rule: str,
5 endpoint: str | None = None,
6 view_func: ft.RouteCallable | None = None,
7 provide_automatic_options: bool | None = None,
8 **options: t.Any,
9 ) -> None:
10 """Register a URL rule with the blueprint. See :meth:`.Flask.add_url_rule` for
11 full documentation.
12
13 The URL rule is prefixed with the blueprint's URL prefix. The endpoint name,
14 used with :func:`url_for`, is prefixed with the blueprint's name.
15 """
16 if endpoint and "." in endpoint:
17 raise ValueError("'endpoint' may not contain a dot '.' character.")
18
19 if view_func and hasattr(view_func, "__name__") and "." in view_func.__name__:
20 raise ValueError("'view_func' name may not contain a dot '.' character.")
21
22 self.record(
23 lambda s: s.add_url_rule(
24 rule,
25 endpoint,
26 view_func,
27 provide_automatic_options=provide_automatic_options,
28 **options,
29 )
30 )
Path 3: 1 calls (0.01)
'/' (1)
None (1)
test_route_decorator_custom_endpoint_with_dots.
None (1)
{} (1)
ValueError (1)
1@setupmethod
2 def add_url_rule(
3 self,
4 rule: str,
5 endpoint: str | None = None,
6 view_func: ft.RouteCallable | None = None,
7 provide_automatic_options: bool | None = None,
8 **options: t.Any,
9 ) -> None:
10 """Register a URL rule with the blueprint. See :meth:`.Flask.add_url_rule` for
11 full documentation.
12
13 The URL rule is prefixed with the blueprint's URL prefix. The endpoint name,
14 used with :func:`url_for`, is prefixed with the blueprint's name.
15 """
16 if endpoint and "." in endpoint:
17 raise ValueError("'endpoint' may not contain a dot '.' character.")
18
19 if view_func and hasattr(view_func, "__name__") and "." in view_func.__name__:
20 raise ValueError("'view_func' name may not contain a dot '.' character.")
21
22 self.record(
23 lambda s: s.add_url_rule(
24 rule,
25 endpoint,
26 view_func,
27 provide_automatic_options=provide_automatic_options,
28 **options,
29 )
30 )