Injects the URL defaults for the given endpoint directly into the values dictionary passed. This is used internally and automatically called on URL building. .. versionadded:: 0.7
(self, endpoint: str, values: dict[str, t.Any])
| 909 | ) |
| 910 | |
| 911 | def inject_url_defaults(self, endpoint: str, values: dict[str, t.Any]) -> None: |
| 912 | """Injects the URL defaults for the given endpoint directly into |
| 913 | the values dictionary passed. This is used internally and |
| 914 | automatically called on URL building. |
| 915 | |
| 916 | .. versionadded:: 0.7 |
| 917 | """ |
| 918 | names: t.Iterable[str | None] = (None,) |
| 919 | |
| 920 | # url_for may be called outside a request context, parse the |
| 921 | # passed endpoint instead of using request.blueprints. |
| 922 | if "." in endpoint: |
| 923 | names = chain( |
| 924 | names, reversed(_split_blueprint_path(endpoint.rpartition(".")[0])) |
| 925 | ) |
| 926 | |
| 927 | for name in names: |
| 928 | if name in self.url_default_functions: |
| 929 | for func in self.url_default_functions[name]: |
| 930 | func(endpoint, values) |
| 931 | |
| 932 | def handle_url_build_error( |
| 933 | self, error: BuildError, endpoint: str, values: dict[str, t.Any] |