diff options
Diffstat (limited to 'app/utils.py')
-rw-r--r-- | app/utils.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/app/utils.py b/app/utils.py index 5960fa6..cc338b4 100644 --- a/app/utils.py +++ b/app/utils.py @@ -23,6 +23,8 @@ from . import app import random, string, os, imghdr from urllib.parse import urljoin +# These are given to Jinja in template_filters.py + def abs_url_for(path, **kwargs): scheme = "https" if app.config["BASE_URL"][:5] == "https" else "http" return url_for(path, _external=True, _scheme=scheme, **kwargs) @@ -30,6 +32,11 @@ def abs_url_for(path, **kwargs): def abs_url(path): return urljoin(app.config["BASE_URL"], path) +def url_set_query(**kwargs): + args = dict(request.args) + args.update(kwargs) + return url_for(request.endpoint, **args) + def get_int_or_abort(v, default=None): if v is None: return default |