From a4c2cfb837a3f92e2c0f0b8a0bac7a6e03499640 Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Tue, 4 Jan 2022 18:00:45 +0100 Subject: [enh] change categories_as_tabs from a list to a dict The tab icon names are currently hard coded in the templates. This commit lets us introduce an icon property in the future, e.g: categories_as_tabs: general: icon: search-outline --- searx/webutils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'searx/webutils.py') diff --git a/searx/webutils.py b/searx/webutils.py index 4c3073aac..0c0854dfc 100644 --- a/searx/webutils.py +++ b/searx/webutils.py @@ -146,7 +146,9 @@ def group_engines_in_tab(engines: Iterable[Engine]) -> List[Tuple[str, Iterable[ """Groups an Iterable of engines by their first non tab category""" def get_group(eng): - non_tab_categories = [c for c in eng.categories if c not in settings['categories_as_tabs'] + [OTHER_CATEGORY]] + non_tab_categories = [ + c for c in eng.categories if c not in list(settings['categories_as_tabs'].keys()) + [OTHER_CATEGORY] + ] return non_tab_categories[0] if len(non_tab_categories) > 0 else DEFAULT_GROUP_NAME groups = itertools.groupby(sorted(engines, key=get_group), get_group) -- cgit v1.2.3