Method: flask.app.Flask.inject_url_defaults
Calls: 41, Exceptions: 0, Paths: 4Back
Path 1: 29 calls (0.71)
'index' (9) 'static' (4) 'spam' (3) 'myview' (3) 'hello' (2) 'view' (2) '/' (1) 'foo' (1) 'bar' (1) '123' (1)
{} (19) {'filename': 'index.html'} (4) {'name': 'test x'} (2) {'company_id': 'xxx'} (2) dict (1) {'id': 42} (1)
1def inject_url_defaults(self, endpoint: str, values: dict) -> None:
2 """Injects the URL defaults for the given endpoint directly into
3 the values dictionary passed. This is used internally and
4 automatically called on URL building.
5
6 .. versionadded:: 0.7
7 """
8 names: t.Iterable[str | None] = (None,)
9
10 # url_for may be called outside a request context, parse the
11 # passed endpoint instead of using request.blueprints.
12 if "." in endpoint:
13 names = chain(
14 names, reversed(_split_blueprint_path(endpoint.rpartition(".")[0]))
15 )
16
17 for name in names:
18 if name in self.url_default_functions:
19 for func in self.url_default_functions[name]:
20 func(endpoint, values)
Path 2: 5 calls (0.12)
'about' (3) 'something_else' (1) 'index' (1)
{} (4) {'lang_code': 'en'} (1)
1def inject_url_defaults(self, endpoint: str, values: dict) -> None:
2 """Injects the URL defaults for the given endpoint directly into
3 the values dictionary passed. This is used internally and
4 automatically called on URL building.
5
6 .. versionadded:: 0.7
7 """
8 names: t.Iterable[str | None] = (None,)
9
10 # url_for may be called outside a request context, parse the
11 # passed endpoint instead of using request.blueprints.
12 if "." in endpoint:
13 names = chain(
14 names, reversed(_split_blueprint_path(endpoint.rpartition(".")[0]))
15 )
16
17 for name in names:
18 if name in self.url_default_functions:
19 for func in self.url_default_functions[name]:
20 func(endpoint, values)
Path 3: 4 calls (0.1)
'foo.view' (2) 'frontend.about' (1) 'frontend.index' (1)
{} (4)
1def inject_url_defaults(self, endpoint: str, values: dict) -> None:
2 """Injects the URL defaults for the given endpoint directly into
3 the values dictionary passed. This is used internally and
4 automatically called on URL building.
5
6 .. versionadded:: 0.7
7 """
8 names: t.Iterable[str | None] = (None,)
9
10 # url_for may be called outside a request context, parse the
11 # passed endpoint instead of using request.blueprints.
12 if "." in endpoint:
13 names = chain(
14 names, reversed(_split_blueprint_path(endpoint.rpartition(".")[0]))
15 )
16
17 for name in names:
18 if name in self.url_default_functions:
19 for func in self.url_default_functions[name]:
20 func(endpoint, values)
Path 4: 3 calls (0.07)
'not.existing' (1) 'admin.static' (1) 'test.index' (1)
{} (2) {'filename': 'test.txt'} (1)
1def inject_url_defaults(self, endpoint: str, values: dict) -> None:
2 """Injects the URL defaults for the given endpoint directly into
3 the values dictionary passed. This is used internally and
4 automatically called on URL building.
5
6 .. versionadded:: 0.7
7 """
8 names: t.Iterable[str | None] = (None,)
9
10 # url_for may be called outside a request context, parse the
11 # passed endpoint instead of using request.blueprints.
12 if "." in endpoint:
13 names = chain(
14 names, reversed(_split_blueprint_path(endpoint.rpartition(".")[0]))
15 )
16
17 for name in names:
18 if name in self.url_default_functions:
19 for func in self.url_default_functions[name]:
20 func(endpoint, values)