[refactor] remove pointless tuple

This commit is contained in:
Martin Fischer 2022-01-04 14:14:37 +01:00
parent bb06758a7b
commit 83f8a8fc6d

View file

@ -22,8 +22,6 @@ from searx.engines import OTHER_CATEGORY
COOKIE_MAX_AGE = 60 * 60 * 24 * 365 * 5 # 5 years COOKIE_MAX_AGE = 60 * 60 * 24 * 365 * 5 # 5 years
DISABLED = 0
ENABLED = 1
DOI_RESOLVERS = list(settings['doi_resolvers']) DOI_RESOLVERS = list(settings['doi_resolvers'])
@ -226,11 +224,11 @@ class SwitchableSetting(Setting):
# pylint: disable=no-self-use # pylint: disable=no-self-use
return values return values
def parse_cookie(self, data): def parse_cookie(self, data_disabled: str, data_enabled: str):
if data[DISABLED] != '': if data_disabled != '':
self.disabled = set(data[DISABLED].split(',')) self.disabled = set(data_disabled.split(','))
if data[ENABLED] != '': if data_enabled != '':
self.enabled = set(data[ENABLED].split(',')) self.enabled = set(data_enabled.split(','))
def parse_form(self, items: List[str]): def parse_form(self, items: List[str]):
if self.locked: if self.locked:
@ -455,13 +453,9 @@ class Preferences:
continue continue
self.key_value_settings[user_setting_name].parse(user_setting) self.key_value_settings[user_setting_name].parse(user_setting)
elif user_setting_name == 'disabled_engines': elif user_setting_name == 'disabled_engines':
self.engines.parse_cookie( self.engines.parse_cookie(input_data.get('disabled_engines', ''), input_data.get('enabled_engines', ''))
(input_data.get('disabled_engines', ''), input_data.get('enabled_engines', ''))
)
elif user_setting_name == 'disabled_plugins': elif user_setting_name == 'disabled_plugins':
self.plugins.parse_cookie( self.plugins.parse_cookie(input_data.get('disabled_plugins', ''), input_data.get('enabled_plugins', ''))
(input_data.get('disabled_plugins', ''), input_data.get('enabled_plugins', ''))
)
elif user_setting_name == 'tokens': elif user_setting_name == 'tokens':
self.tokens.parse(user_setting) self.tokens.parse(user_setting)
elif not any( elif not any(