summaryrefslogtreecommitdiff
path: root/searx/utils.py
diff options
context:
space:
mode:
authorNoemi Vanyi <sitbackandwait@gmail.com>2016-04-08 16:38:05 +0200
committerNoemi Vanyi <sitbackandwait@gmail.com>2016-04-09 01:08:44 +0200
commitfe691a09888f6e6c6cc647de06f4eca0feb3451f (patch)
treeb0e554726757290f8eff4bd44541c84dee38479d /searx/utils.py
parent9331fc28a8ac2f898a437d126ee59353f7f1bfde (diff)
downloadsearxng-fe691a09888f6e6c6cc647de06f4eca0feb3451f.tar.gz
searxng-fe691a09888f6e6c6cc647de06f4eca0feb3451f.zip
new preferences handling
Preferences class was introduced in order to handle user preferences. Right now it parses cookies and the form in preferences. Also it can retrieve settings based on the name of the setting. ATTENTION Please note that engine preferences are handled differently from now on. So it introduces incompatible changes. Every user who has saved preferences should reset and save his/her settings again. This change was needed, because everytime a default disabled engine was added saved user preferences would broke. Now engine setting tracking is fixed.
Diffstat (limited to 'searx/utils.py')
-rw-r--r--searx/utils.py23
1 files changed, 0 insertions, 23 deletions
diff --git a/searx/utils.py b/searx/utils.py
index 506228465..b297582ef 100644
--- a/searx/utils.py
+++ b/searx/utils.py
@@ -230,26 +230,3 @@ def list_get(a_list, index, default=None):
return a_list[index]
else:
return default
-
-
-def get_blocked_engines(engines, cookies):
- if 'blocked_engines' not in cookies:
- return [(engine_name, category) for engine_name in engines
- for category in engines[engine_name].categories if engines[engine_name].disabled]
-
- blocked_engine_strings = cookies.get('blocked_engines', '').split(',')
- blocked_engines = []
-
- if not blocked_engine_strings:
- return blocked_engines
-
- for engine_string in blocked_engine_strings:
- if engine_string.find('__') > -1:
- engine, category = engine_string.split('__', 1)
- if engine in engines and category in engines[engine].categories:
- blocked_engines.append((engine, category))
- elif engine_string in engines:
- for category in engines[engine_string].categories:
- blocked_engines.append((engine_string, category))
-
- return blocked_engines