mirror of
https://github.com/searxng/searxng.git
synced 2024-11-26 21:01:01 +00:00
rename blocked engines to diabled engines
This commit is contained in:
parent
006841c4ff
commit
8c4db08443
3 changed files with 17 additions and 18 deletions
|
@ -28,12 +28,12 @@ import re
|
||||||
class Query(object):
|
class Query(object):
|
||||||
"""parse query"""
|
"""parse query"""
|
||||||
|
|
||||||
def __init__(self, query, blocked_engines):
|
def __init__(self, query, disabled_engines):
|
||||||
self.query = query
|
self.query = query
|
||||||
self.blocked_engines = []
|
self.disabled_engines = []
|
||||||
|
|
||||||
if blocked_engines:
|
if disabled_engines:
|
||||||
self.blocked_engines = blocked_engines
|
self.disabled_engines = disabled_engines
|
||||||
|
|
||||||
self.query_parts = []
|
self.query_parts = []
|
||||||
self.engines = []
|
self.engines = []
|
||||||
|
@ -107,7 +107,7 @@ class Query(object):
|
||||||
self.engines.extend({'category': prefix,
|
self.engines.extend({'category': prefix,
|
||||||
'name': engine.name}
|
'name': engine.name}
|
||||||
for engine in categories[prefix]
|
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] == '!':
|
if query_part[0] == '!':
|
||||||
self.specific = True
|
self.specific = True
|
||||||
|
|
|
@ -140,7 +140,7 @@ class Search(object):
|
||||||
self.lang = 'all'
|
self.lang = 'all'
|
||||||
|
|
||||||
# set blocked engines
|
# set blocked engines
|
||||||
self.blocked_engines = request.preferences.engines.get_disabled()
|
self.disabled_engines = request.preferences.engines.get_disabled()
|
||||||
|
|
||||||
self.result_container = ResultContainer()
|
self.result_container = ResultContainer()
|
||||||
self.request_data = {}
|
self.request_data = {}
|
||||||
|
@ -167,7 +167,7 @@ class Search(object):
|
||||||
|
|
||||||
# parse query, if tags are set, which change
|
# parse query, if tags are set, which change
|
||||||
# the serch engine or search-language
|
# 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()
|
query_obj.parse_query()
|
||||||
|
|
||||||
# set query
|
# set query
|
||||||
|
@ -244,7 +244,7 @@ class Search(object):
|
||||||
self.engines.extend({'category': categ,
|
self.engines.extend({'category': categ,
|
||||||
'name': engine.name}
|
'name': engine.name}
|
||||||
for engine in categories[categ]
|
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
|
# remove suspended engines
|
||||||
self.engines = [e for e in self.engines
|
self.engines = [e for e in self.engines
|
||||||
|
|
|
@ -259,19 +259,18 @@ def image_proxify(url):
|
||||||
|
|
||||||
|
|
||||||
def render(template_name, override_theme=None, **kwargs):
|
def render(template_name, override_theme=None, **kwargs):
|
||||||
blocked_engines = request.preferences.engines.get_disabled()
|
disabled_engines = request.preferences.engines.get_disabled()
|
||||||
autocomplete = request.preferences.get_value('autocomplete')
|
|
||||||
|
|
||||||
nonblocked_categories = set(category for engine_name in engines
|
enabled_categories = set(category for engine_name in engines
|
||||||
for category in engines[engine_name].categories
|
for category in engines[engine_name].categories
|
||||||
if (engine_name, category) not in blocked_engines)
|
if (engine_name, category) not in disabled_engines)
|
||||||
|
|
||||||
if 'categories' not in kwargs:
|
if 'categories' not in kwargs:
|
||||||
kwargs['categories'] = ['general']
|
kwargs['categories'] = ['general']
|
||||||
kwargs['categories'].extend(x for x in
|
kwargs['categories'].extend(x for x in
|
||||||
sorted(categories.keys())
|
sorted(categories.keys())
|
||||||
if x != 'general'
|
if x != 'general'
|
||||||
and x in nonblocked_categories)
|
and x in enabled_categories)
|
||||||
|
|
||||||
if 'all_categories' not in kwargs:
|
if 'all_categories' not in kwargs:
|
||||||
kwargs['all_categories'] = ['general']
|
kwargs['all_categories'] = ['general']
|
||||||
|
@ -483,10 +482,10 @@ def autocompleter():
|
||||||
request_data = request.args
|
request_data = request.args
|
||||||
|
|
||||||
# set blocked engines
|
# set blocked engines
|
||||||
blocked_engines = request.preferences.engines.get_disabled()
|
disabled_engines = request.preferences.engines.get_disabled()
|
||||||
|
|
||||||
# parse query
|
# 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()
|
query.parse_query()
|
||||||
|
|
||||||
# check if search query is set
|
# check if search query is set
|
||||||
|
@ -544,7 +543,7 @@ def preferences():
|
||||||
# render preferences
|
# render preferences
|
||||||
image_proxy = request.preferences.get_value('image_proxy')
|
image_proxy = request.preferences.get_value('image_proxy')
|
||||||
lang = request.preferences.get_value('language')
|
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()
|
allowed_plugins = request.preferences.plugins.get_enabled()
|
||||||
|
|
||||||
# stats for preferences page
|
# stats for preferences page
|
||||||
|
@ -572,7 +571,7 @@ def preferences():
|
||||||
language_codes=language_codes,
|
language_codes=language_codes,
|
||||||
engines_by_category=categories,
|
engines_by_category=categories,
|
||||||
stats=stats,
|
stats=stats,
|
||||||
blocked_engines=blocked_engines,
|
blocked_engines=disabled_engines,
|
||||||
autocomplete_backends=autocomplete_backends,
|
autocomplete_backends=autocomplete_backends,
|
||||||
shortcuts={y: x for x, y in engine_shortcuts.items()},
|
shortcuts={y: x for x, y in engine_shortcuts.items()},
|
||||||
themes=themes,
|
themes=themes,
|
||||||
|
|
Loading…
Reference in a new issue