mirror of https://github.com/searxng/searxng
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ef81d14ccf
When a user selects an unknown or invalid locale by using the search syntax: !qw siemens :de-TW Before this patch a UnknownLocaleError exception will be rasied: ``` Traceback (most recent call last): File "SearXNG/searx/search/processors/online.py", line 154, in search search_results = self._search_basic(query, params) File "SearXNG/searx/search/processors/online.py", line 128, in _search_basic self.engine.request(query, params) File "SearXNG/searx/engines/qwant.py", line 98, in request q_locale = get_engine_locale(params['language'], supported_languages, default='en_US') File "SearXNG/searx/locales.py", line 216, in get_engine_locale locale = babel.Locale.parse(searxng_locale, sep='-') File "SearXNG/local/py3/lib/python3.8/site-packages/babel/core.py", line 330, in parse raise UnknownLocaleError(input_id) ``` This patch implements a simple exception handling, since e.g. `de-TW` does not exists `de` will be used to get engines locale. On invalid terms like `xy-XY` the default will be returned. Signed-off-by: Markus Heiser <markus.heiser@darmarit.de> |
2 years ago | |
---|---|---|
.. | ||
answerers | 3 years ago | |
data | 2 years ago | |
engines | 2 years ago | |
infopage | 2 years ago | |
metrics | 2 years ago | |
network | 2 years ago | |
plugins | 2 years ago | |
search | 2 years ago | |
shared | 2 years ago | |
static | 2 years ago | |
templates/simple | 2 years ago | |
translations | 2 years ago | |
__init__.py | 3 years ago | |
autocomplete.py | 2 years ago | |
babel_extract.py | 3 years ago | |
compat.py | 2 years ago | |
exceptions.py | 3 years ago | |
external_bang.py | 3 years ago | |
external_urls.py | 3 years ago | |
flaskfix.py | 3 years ago | |
languages.py | 3 years ago | |
locales.py | 2 years ago | |
preferences.py | 2 years ago | |
query.py | 3 years ago | |
redislib.py | 2 years ago | |
results.py | 3 years ago | |
searxng.msg | 3 years ago | |
settings.yml | 2 years ago | |
settings_defaults.py | 2 years ago | |
settings_loader.py | 3 years ago | |
unixthreadname.py | 3 years ago | |
utils.py | 2 years ago | |
version.py | 2 years ago | |
webadapter.py | 3 years ago | |
webapp.py | 2 years ago | |
webutils.py | 2 years ago |