* add button for languages setting * build a web module for the dashboard - load all python module from local dir - initialize Blueprint and Babel * set a default key for secure cookies * add translations to docker container * improve translation build - clean target erases the *.pot - don't modify the resurt of url_for() calls - don't translate the language description * translate connection table, fix icon * build relative urls for HA ingress * fix unit test, increase coverage
27 lines
930 B
Python
27 lines
930 B
Python
from quart import url_for as quart_url_for
|
|
from . import web
|
|
|
|
|
|
def url_for(*args, **kwargs):
|
|
"""Return the url for a specific endpoint.
|
|
|
|
This wrapper optionally convert into a relative url.
|
|
|
|
This is most useful in templates and redirects to create a URL
|
|
that can be used in the browser.
|
|
|
|
Arguments:
|
|
endpoint: The endpoint to build a url for, if prefixed with
|
|
``.`` it targets endpoint's in the current blueprint.
|
|
_anchor: Additional anchor text to append (i.e. #text).
|
|
_external: Return an absolute url for external (to app) usage.
|
|
_method: The method to consider alongside the endpoint.
|
|
_scheme: A specific scheme to use.
|
|
values: The values to build into the URL, as specified in
|
|
the endpoint rule.
|
|
"""
|
|
url = quart_url_for(*args, **kwargs)
|
|
if '/' == url[0] and web.build_relative_urls:
|
|
url = '.' + url
|
|
return url
|