commit: 727c287856629cf7c11b87cecbf1b32bb0ca1831
parent 922d51bf0c992cee71a69496efbfafee5c81afcf
Author: marc <a01200356@itesm.mx>
Date: Mon, 31 Oct 2016 00:54:29 -0600
[fix] backwards compatibility with old language cookies
Diffstat:
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/searx/preferences.py b/searx/preferences.py
@@ -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