mirror of
https://github.com/searxng/searxng.git
synced 2024-11-19 02:40:11 +01:00
[fix] backwards compatibility with old language cookies
This commit is contained in:
parent
922d51bf0c
commit
727c287856
@ -59,7 +59,18 @@ class EnumStringSetting(Setting):
|
||||
self._validate_selection(self.value)
|
||||
|
||||
def parse(self, data):
|
||||
self._validate_selection(data)
|
||||
if data not in self.choices and data != self.value:
|
||||
# hack to give some backwards compatibility with old language cookies
|
||||
data = str(data).replace('_', '-')
|
||||
lang = data[:2]
|
||||
if data in self.choices:
|
||||
pass
|
||||
elif lang in self.choices:
|
||||
data = lang
|
||||
elif data == 'ar-XA':
|
||||
data = 'ar-SA'
|
||||
else:
|
||||
data = 'all'
|
||||
self.value = data
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user