1
0
mirror of https://github.com/searxng/searxng.git synced 2024-11-22 12:10:11 +01:00

rename blocked engines to diabled engines

This commit is contained in:
Noemi Vanyi 2016-04-09 18:26:29 +02:00
parent 006841c4ff
commit 8c4db08443
3 changed files with 17 additions and 18 deletions

View File

@ -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

View File

@ -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

View File

@ -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,