From 006841c4ff481b023dccd188582a9cbac64415da Mon Sep 17 00:00:00 2001 From: Noemi Vanyi Date: Sat, 9 Apr 2016 14:46:02 +0200 Subject: minor grammar fix in error message --- searx/webapp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'searx/webapp.py') diff --git a/searx/webapp.py b/searx/webapp.py index 7f0b56101..5b15c43d1 100644 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -74,7 +74,7 @@ try: import pyasn1 # NOQA except ImportError: logger.critical("The pyopenssl, ndg-httpsclient, pyasn1 packages have to be installed.\n" - "Some HTTPS connections will failed") + "Some HTTPS connections will fail") static_path, templates_path, themes =\ -- cgit v1.2.3 From 8c4db08443c7a55344fa0011b89303467fa62efe Mon Sep 17 00:00:00 2001 From: Noemi Vanyi Date: Sat, 9 Apr 2016 18:26:29 +0200 Subject: rename blocked engines to diabled engines --- searx/webapp.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'searx/webapp.py') diff --git a/searx/webapp.py b/searx/webapp.py index 5b15c43d1..1420906f5 100644 --- 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, -- cgit v1.2.3 From 5867e979664d655616e09b74b81fb099a2504ba8 Mon Sep 17 00:00:00 2001 From: Noemi Vanyi Date: Sat, 9 Apr 2016 18:32:07 +0200 Subject: more follow ups in new preferences --- searx/webapp.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'searx/webapp.py') diff --git a/searx/webapp.py b/searx/webapp.py index 1420906f5..e4e99de62 100644 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -128,11 +128,8 @@ outgoing_proxies = settings['outgoing'].get('proxies', None) def get_locale(): locale = request.accept_languages.best_match(settings['locales'].keys()) - if settings['ui'].get('default_locale'): - locale = settings['ui']['default_locale'] - - if request.cookies.get('locale', '') in settings['locales']: - locale = request.cookies.get('locale', '') + if request.preferences.get_value('locale') != '': + locale = request.preferences.get_value('locale') if 'locale' in request.args\ and request.args['locale'] in settings['locales']: @@ -248,7 +245,7 @@ def image_proxify(url): if url.startswith('//'): url = 'https:' + url - if not settings['server'].get('image_proxy') and not request.cookies.get('image_proxy'): + if not request.preferences.get_value('image_proxy'): return url hash_string = url + settings['server']['secret_key'] @@ -289,14 +286,13 @@ def render(template_name, override_theme=None, **kwargs): if not kwargs['selected_categories']: cookie_categories = request.preferences.get_value('categories') for ccateg in cookie_categories: - if ccateg in categories: - kwargs['selected_categories'].append(ccateg) + kwargs['selected_categories'].append(ccateg) if not kwargs['selected_categories']: kwargs['selected_categories'] = ['general'] if 'autocomplete' not in kwargs: - kwargs['autocomplete'] = autocomplete + kwargs['autocomplete'] = request.preferences.get_value('autocomplete') if get_locale() in rtl_locales and 'rtl' not in kwargs: kwargs['rtl'] = True @@ -501,7 +497,7 @@ def autocompleter(): # normal autocompletion results only appear if max 3 inner results returned if len(raw_results) <= 3 and completer: # get language from cookie - language = request.cookies.get('language') + language = request.preferences.get_value('language') if not language or language == 'all': language = 'en' else: -- cgit v1.2.3 From 7daf98933d39151ab5fd7929645f26497db8b8af Mon Sep 17 00:00:00 2001 From: Noemi Vanyi Date: Sat, 9 Apr 2016 18:48:23 +0200 Subject: follow up blocked_engines renaming in templates --- searx/webapp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'searx/webapp.py') diff --git a/searx/webapp.py b/searx/webapp.py index e4e99de62..e05a08a2f 100644 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -567,7 +567,7 @@ def preferences(): language_codes=language_codes, engines_by_category=categories, stats=stats, - blocked_engines=disabled_engines, + disabled_engines=disabled_engines, autocomplete_backends=autocomplete_backends, shortcuts={y: x for x, y in engine_shortcuts.items()}, themes=themes, -- cgit v1.2.3 From adb1169fa31b6c504a3f99123d711b3f5c4bf070 Mon Sep 17 00:00:00 2001 From: Noemi Vanyi Date: Sat, 9 Apr 2016 19:47:06 +0200 Subject: add description to a var that seems to be unused --- searx/webapp.py | 1 + 1 file changed, 1 insertion(+) (limited to 'searx/webapp.py') diff --git a/searx/webapp.py b/searx/webapp.py index e05a08a2f..ed8ff1bd9 100644 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -110,6 +110,7 @@ for indice, theme in enumerate(themes): for (dirpath, dirnames, filenames) in os.walk(theme_img_path): global_favicons[indice].extend(filenames) +# used when translating category names _category_names = (gettext('files'), gettext('general'), gettext('music'), -- cgit v1.2.3