From 2f086f24d782144b304091e72c66ca75c006a98a Mon Sep 17 00:00:00 2001 From: "Jannis M. Hoffmann" Date: Sun, 8 Dec 2024 16:31:04 +0100 Subject: improve adding and retreiving url arguments from forms --- src/jwebmail/__init__.py | 2 +- src/jwebmail/templates/_bot_nav.html | 16 ++++++---------- src/jwebmail/webmail.py | 15 +++------------ 3 files changed, 10 insertions(+), 23 deletions(-) diff --git a/src/jwebmail/__init__.py b/src/jwebmail/__init__.py index 8b98e7a..86febf4 100644 --- a/src/jwebmail/__init__.py +++ b/src/jwebmail/__init__.py @@ -36,7 +36,7 @@ else: toml_read_file = dict(load=toml_load, text=True) -__version__ = "2.8.0.dev0" +__version__ = "2.8.1.dev0" csrf = CSRFProtect() diff --git a/src/jwebmail/templates/_bot_nav.html b/src/jwebmail/templates/_bot_nav.html index bd9e05a..d92d467 100644 --- a/src/jwebmail/templates/_bot_nav.html +++ b/src/jwebmail/templates/_bot_nav.html @@ -45,11 +45,9 @@ {% if mail_folders|length > 1 %}
- - - - - + {% for k, v in request.args.items() if v %} + + {% endfor %}
@@ -73,11 +71,9 @@ method=POST class="is-pulled-left ml-2"> - - - - - + {% for k, v in request.args.items() if v %} + + {% endfor %}
diff --git a/src/jwebmail/webmail.py b/src/jwebmail/webmail.py index 1b14af0..4ca1a67 100644 --- a/src/jwebmail/webmail.py +++ b/src/jwebmail/webmail.py @@ -202,18 +202,9 @@ def writemail(): def _take_common_req_args(mapping): - res = dict() - if mapping.get("sort"): - res["sort"] = mapping["sort"] - if mapping.get("search"): - res["search"] = mapping["search"] - if mapping.get("per_page"): - res["per_page"] = mapping["per_page"] - if mapping.get("page_bound"): - res["page_bound"] = mapping["page_bound"] - if mapping.get("after_page"): - res["after_page"] = mapping["after_page"] - return res + take = {"sort", "search", "per_page", "page_bound", "after_page"} + + return {k: v for k, v in mapping.items() if k in take} def move(folder=""): -- cgit v1.2.3