From cdb4927b8ba0aec61ae169b9e9b54a7e8f2f0e9f Mon Sep 17 00:00:00 2001 From: Markus Date: Sun, 15 Sep 2024 12:22:06 +0200 Subject: [fix] fetch_traits: brave, google, annas_archive & radio_browser This patch fixes a bug reported by CI "Fetch traits" [1] (brave) and improves other fetch traits functions (google, annas_archive & radio_browser). brave: File "/home/runner/work/searxng/searxng/searx/engines/brave.py", line 434, in fetch_traits sxng_tag = region_tag(babel.Locale.parse(ui_lang, sep='-')) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/runner/work/searxng/searxng/searx/locales.py", line 155, in region_tag Error: raise ValueError('%s missed a territory') google: change ERROR message about unknow UI language to INFO message radio_browser: country_list contains duplicates that differ only in upper/lower case annas_archive: for better diff; sort the persistence of the traits [1] https://github.com/searxng/searxng/actions/runs/10606312371/job/29433352518#step:6:41 Signed-off-by: Markus --- searx/locales.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'searx/locales.py') diff --git a/searx/locales.py b/searx/locales.py index ea9af9438..d7592df3d 100644 --- a/searx/locales.py +++ b/searx/locales.py @@ -152,7 +152,7 @@ def locales_initialize(): def region_tag(locale: babel.Locale) -> str: """Returns SearXNG's region tag from the locale (e.g. zh-TW , en-US).""" if not locale.territory: - raise ValueError('%s missed a territory') + raise ValueError('babel.Locale %s: missed a territory' % locale) return locale.language + '-' + locale.territory -- cgit v1.2.3