commit: 8c4db08443c7a55344fa0011b89303467fa62efe
parent 006841c4ff481b023dccd188582a9cbac64415da
Author: Noemi Vanyi <sitbackandwait@gmail.com>
Date: Sat, 9 Apr 2016 18:26:29 +0200
rename blocked engines to diabled engines
Diffstat:
3 files changed, 17 insertions(+), 18 deletions(-)
diff --git a/searx/query.py b/searx/query.py
@@ -28,12 +28,12 @@ import re
class Query(object):
"""parse query"""
- def __init__(self, query, blocked_engines):
+ def __init__(self, query, disabled_engines):
self.query = query
- self.blocked_engines = []
+ self.disabled_engines = []
- if blocked_engines:
- self.blocked_engines = blocked_engines
+ if disabled_engines:
+ self.disabled_engines = disabled_engines
self.query_parts = []
self.engines = []
@@ -107,7 +107,7 @@ class Query(object):
self.engines.extend({'category': prefix,
'name': engine.name}
for engine in categories[prefix]
- if (engine.name, prefix) not in self.blocked_engines)
+ if (engine.name, prefix) not in self.disabled_engines)
if query_part[0] == '!':
self.specific = True
diff --git a/searx/search.py b/searx/search.py
@@ -140,7 +140,7 @@ class Search(object):
self.lang = 'all'
# set blocked engines
- self.blocked_engines = request.preferences.engines.get_disabled()
+ self.disabled_engines = request.preferences.engines.get_disabled()
self.result_container = ResultContainer()
self.request_data = {}
@@ -167,7 +167,7 @@ class Search(object):
# parse query, if tags are set, which change
# the serch engine or search-language
- query_obj = Query(self.request_data['q'], self.blocked_engines)
+ query_obj = Query(self.request_data['q'], self.disabled_engines)
query_obj.parse_query()
# set query
@@ -244,7 +244,7 @@ class Search(object):
self.engines.extend({'category': categ,
'name': engine.name}
for engine in categories[categ]
- if (engine.name, categ) not in self.blocked_engines)
+ if (engine.name, categ) not in self.disabled_engines)
# remove suspended engines
self.engines = [e for e in self.engines
diff --git a/searx/webapp.py b/searx/webapp.py
@@ -259,19 +259,18 @@ def image_proxify(url):
def render(template_name, override_theme=None, **kwargs):
- blocked_engines = request.preferences.engines.get_disabled()
- autocomplete = request.preferences.get_value('autocomplete')
+ disabled_engines = request.preferences.engines.get_disabled()
- nonblocked_categories = set(category for engine_name in engines
- for category in engines[engine_name].categories
- if (engine_name, category) not in blocked_engines)
+ enabled_categories = set(category for engine_name in engines
+ for category in engines[engine_name].categories
+ if (engine_name, category) not in disabled_engines)
if 'categories' not in kwargs:
kwargs['categories'] = ['general']
kwargs['categories'].extend(x for x in
sorted(categories.keys())
if x != 'general'
- and x in nonblocked_categories)
+ and x in enabled_categories)
if 'all_categories' not in kwargs:
kwargs['all_categories'] = ['general']
@@ -483,10 +482,10 @@ def autocompleter():
request_data = request.args
# set blocked engines
- blocked_engines = request.preferences.engines.get_disabled()
+ disabled_engines = request.preferences.engines.get_disabled()
# parse query
- query = Query(request_data.get('q', '').encode('utf-8'), blocked_engines)
+ query = Query(request_data.get('q', '').encode('utf-8'), disabled_engines)
query.parse_query()
# check if search query is set
@@ -544,7 +543,7 @@ def preferences():
# render preferences
image_proxy = request.preferences.get_value('image_proxy')
lang = request.preferences.get_value('language')
- blocked_engines = request.preferences.engines.get_disabled()
+ disabled_engines = request.preferences.engines.get_disabled()
allowed_plugins = request.preferences.plugins.get_enabled()
# stats for preferences page
@@ -572,7 +571,7 @@ def preferences():
language_codes=language_codes,
engines_by_category=categories,
stats=stats,
- blocked_engines=blocked_engines,
+ blocked_engines=disabled_engines,
autocomplete_backends=autocomplete_backends,
shortcuts={y: x for x, y in engine_shortcuts.items()},
themes=themes,