mirror of https://github.com/searxng/searxng.git
Merge pull request #2452 from return42/fix-2434
[fix] ClientPref - don't raise exception if Accept-Language is invalid
This commit is contained in:
commit
cea277ce52
|
@ -331,8 +331,12 @@ class ClientPref:
|
||||||
except (ValueError, babel.core.UnknownLocaleError):
|
except (ValueError, babel.core.UnknownLocaleError):
|
||||||
continue
|
continue
|
||||||
pairs.append((locale, qvalue))
|
pairs.append((locale, qvalue))
|
||||||
|
|
||||||
|
locale = None
|
||||||
|
if pairs:
|
||||||
pairs.sort(reverse=True, key=lambda x: x[1])
|
pairs.sort(reverse=True, key=lambda x: x[1])
|
||||||
return cls(locale=pairs[0][0])
|
locale = pairs[0][0]
|
||||||
|
return cls(locale=locale)
|
||||||
|
|
||||||
|
|
||||||
class Preferences:
|
class Preferences:
|
||||||
|
|
Loading…
Reference in New Issue