From 5592e6e181fde43882645a27af2e6dd96c9e372e Mon Sep 17 00:00:00 2001 From: Manuel Reinhardt Date: Mon, 8 Jan 2024 10:51:50 +0100 Subject: [PATCH 1/3] Mailing Lists JSON: Show paths in results if not trivial syslabcom/scrum#1638 --- src/osha/oira/client/browser/client.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/osha/oira/client/browser/client.py b/src/osha/oira/client/browser/client.py index 44acd16c..93f082cf 100644 --- a/src/osha/oira/client/browser/client.py +++ b/src/osha/oira/client/browser/client.py @@ -81,6 +81,13 @@ def __call__(self): class MailingListsJson(BaseJson): """Mailing lists (countries and tools, in the future also sectors)""" + def _get_entry(self, list_id, title): + encoded_title = b64encode(title.encode("utf-8")).decode("utf-8") + return { + "id": "|".join((list_id, encoded_title)), + "text": f"{title} ({list_id})" if "/" in list_id else title, + } + @property def results(self): """List of "mailing list" path/names. From 9bf19a3211f57dee1fa23d761d280f0dd8205a09 Mon Sep 17 00:00:00 2001 From: Manuel Reinhardt Date: Mon, 8 Jan 2024 10:55:33 +0100 Subject: [PATCH 2/3] Mailing Lists JSON: Filter for path if query contains slash ("/") syslabcom/scrum#1638 --- src/osha/oira/client/browser/client.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/osha/oira/client/browser/client.py b/src/osha/oira/client/browser/client.py index 93f082cf..b6d076da 100644 --- a/src/osha/oira/client/browser/client.py +++ b/src/osha/oira/client/browser/client.py @@ -125,7 +125,10 @@ def results(self): # Filter for query string if given. Else return all results. if q: - query["Title"] = f"*{q}*" + if "/" not in q: + query["Title"] = f"*{q}*" + else: + query["path"] = "/".join((query["path"], q)) brains = catalog(**query) From 3f357d995f9b041144e12ce172779e3f46734460 Mon Sep 17 00:00:00 2001 From: Manuel Reinhardt Date: Wed, 10 Jan 2024 14:45:10 +0100 Subject: [PATCH 3/3] Update change log syslabcom/scrum#1638 --- docs/changes.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/changes.rst b/docs/changes.rst index 7417e971..5f20df32 100644 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -4,7 +4,9 @@ Changelog 9.0.6 (unreleased) ------------------ -- Nothing changed yet. +- Mailing lists: Allow searching for path. Show path in result. + (`#1638 `_) + [reinhardt] 9.0.5 (2024-01-08)