MCPcopy
hub / github.com/pallets/flask / inject_url_defaults

Method inject_url_defaults

src/flask/sansio/app.py:911–930  ·  view source on GitHub ↗

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])

Source from the content-addressed store, hash-verified

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]

Callers 2

url_forMethod · 0.80

Calls 1

_split_blueprint_pathFunction · 0.85

Tested by 1