Method: flask.helpers.url_for
Calls: 43, Exceptions: 6, Paths: 2Back
Path 1: 42 calls (0.98)
'index' (12) 'static' (4) 'spam' (3) 'about' (3) 'myview' (3) 'hello' (2) 'view' (2) 'not.existing' (1) '/' (1) 'something_else' (1)
None (41) 'x y' (1)
None (39) 'GET' (2) 'POST' (1)
None (38) 'https' (4)
None (33) True (8) False (1)
{} (30) {'filename': 'index.html'} (4) {'name': 'test x'} (2) {'company_id': 'xxx'} (2) {'lang_code': 'en'} (1) {'filename': 'test.txt'} (1) dict (1) ...
None (5) 'https://localhost/' (4) '/de/about' (3) '/foo/index.html' (2) '/de/' (2) 'http://localhost/' (2) '/hello/test%20x' (1) 'http://localhost/hel...
BuildError (3) RuntimeError (1) ValueError (1)
1def url_for(
2 endpoint: str,
3 *,
4 _anchor: str | None = None,
5 _method: str | None = None,
6 _scheme: str | None = None,
7 _external: bool | None = None,
8 **values: t.Any,
9) -> str:
10 """Generate a URL to the given endpoint with the given values.
11
12 This requires an active request or application context, and calls
13 :meth:`current_app.url_for() <flask.Flask.url_for>`. See that method
14 for full documentation.
15
16 :param endpoint: The endpoint name associated with the URL to
17 generate. If this starts with a ``.``, the current blueprint
18 name (if any) will be used.
19 :param _anchor: If given, append this as ``#anchor`` to the URL.
20 :param _method: If given, generate the URL associated with this
21 method for the endpoint.
22 :param _scheme: If given, the URL will have this scheme if it is
23 external.
24 :param _external: If given, prefer the URL to be internal (False) or
25 require it to be external (True). External URLs include the
26 scheme and domain. When not in an active request, URLs are
27 external by default.
28 :param values: Values to use for the variable parts of the URL rule.
29 Unknown keys are appended as query string arguments, like
30 ``?a=b&c=d``.
31
32 .. versionchanged:: 2.2
33 Calls ``current_app.url_for``, allowing an app to override the
34 behavior.
35
36 .. versionchanged:: 0.10
37 The ``_scheme`` parameter was added.
38
39 .. versionchanged:: 0.9
40 The ``_anchor`` and ``_method`` parameters were added.
41
42 .. versionchanged:: 0.9
43 Calls ``app.handle_url_build_error`` on build errors.
44 """
45 return current_app.url_for(
46 endpoint,
47 _anchor=_anchor,
48 _method=_method,
49 _scheme=_scheme,
50 _external=_external,
51 **values,
52 )
Path 2: 1 calls (0.02)
'index' (1)
None (1)
None (1)
None (1)
None (1)
{} (1)
None (1)
RuntimeError (1)
1def url_for(
2 endpoint: str,
3 *,
4 _anchor: str | None = None,
5 _method: str | None = None,
6 _scheme: str | None = None,
7 _external: bool | None = None,
8 **values: t.Any,
9) -> str:
10 """Generate a URL to the given endpoint with the given values.
11
12 This requires an active request or application context, and calls
13 :meth:`current_app.url_for() <flask.Flask.url_for>`. See that method
14 for full documentation.
15
16 :param endpoint: The endpoint name associated with the URL to
17 generate. If this starts with a ``.``, the current blueprint
18 name (if any) will be used.
19 :param _anchor: If given, append this as ``#anchor`` to the URL.
20 :param _method: If given, generate the URL associated with this
21 method for the endpoint.
22 :param _scheme: If given, the URL will have this scheme if it is
23 external.
24 :param _external: If given, prefer the URL to be internal (False) or
25 require it to be external (True). External URLs include the
26 scheme and domain. When not in an active request, URLs are
27 external by default.
28 :param values: Values to use for the variable parts of the URL rule.
29 Unknown keys are appended as query string arguments, like
30 ``?a=b&c=d``.
31
32 .. versionchanged:: 2.2
33 Calls ``current_app.url_for``, allowing an app to override the
34 behavior.
35
36 .. versionchanged:: 0.10
37 The ``_scheme`` parameter was added.
38
39 .. versionchanged:: 0.9
40 The ``_anchor`` and ``_method`` parameters were added.
41
42 .. versionchanged:: 0.9
43 Calls ``app.handle_url_build_error`` on build errors.
44 """
45 return current_app.url_for(
46 endpoint,
47 _anchor=_anchor,
48 _method=_method,
49 _scheme=_scheme,
50 _external=_external,
51 **values,
52 )