diff options
author | marc <a01200356@itesm.mx> | 2016-10-31 00:54:29 -0600 |
---|---|---|
committer | marc <a01200356@itesm.mx> | 2016-12-13 19:56:58 -0600 |
commit | 727c287856629cf7c11b87cecbf1b32bb0ca1831 (patch) | |
tree | d3ee7a92a0fec38ac4fdedb59ac261f5ac53bdd1 /searx/preferences.py | |
parent | 922d51bf0c992cee71a69496efbfafee5c81afcf (diff) | |
download | searxng-727c287856629cf7c11b87cecbf1b32bb0ca1831.tar.gz searxng-727c287856629cf7c11b87cecbf1b32bb0ca1831.zip |
[fix] backwards compatibility with old language cookies
Diffstat (limited to 'searx/preferences.py')
-rw-r--r-- | searx/preferences.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/searx/preferences.py b/searx/preferences.py index 4436b8fe8..b27cfb7f4 100644 --- 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 |