mirror of
https://github.com/searxng/searxng.git
synced 2024-12-25 02:30:29 +00:00
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
1 changed files with 6 additions and 2 deletions
|
@ -331,8 +331,12 @@ class ClientPref:
|
|||
except (ValueError, babel.core.UnknownLocaleError):
|
||||
continue
|
||||
pairs.append((locale, qvalue))
|
||||
pairs.sort(reverse=True, key=lambda x: x[1])
|
||||
return cls(locale=pairs[0][0])
|
||||
|
||||
locale = None
|
||||
if pairs:
|
||||
pairs.sort(reverse=True, key=lambda x: x[1])
|
||||
locale = pairs[0][0]
|
||||
return cls(locale=locale)
|
||||
|
||||
|
||||
class Preferences:
|
||||
|
|
Loading…
Reference in a new issue