diff options
author | Noemi Vanyi <sitbackandwait@gmail.com> | 2016-04-09 18:32:07 +0200 |
---|---|---|
committer | Noemi Vanyi <sitbackandwait@gmail.com> | 2016-04-09 19:49:59 +0200 |
commit | 5867e979664d655616e09b74b81fb099a2504ba8 (patch) | |
tree | 39f7a2b169b9c26204c1cf0daaa0a826e3d52e74 /searx | |
parent | 8c4db08443c7a55344fa0011b89303467fa62efe (diff) | |
download | searxng-5867e979664d655616e09b74b81fb099a2504ba8.tar.gz searxng-5867e979664d655616e09b74b81fb099a2504ba8.zip |
more follow ups in new preferences
Diffstat (limited to 'searx')
-rw-r--r-- | searx/search.py | 3 | ||||
-rw-r--r-- | searx/webapp.py | 16 |
2 files changed, 7 insertions, 12 deletions
diff --git a/searx/search.py b/searx/search.py index 215774c06..a40801640 100644 --- a/searx/search.py +++ b/searx/search.py @@ -227,8 +227,7 @@ class Search(object): # using user-defined default-configuration which # (is stored in cookie) if not self.categories: - cookie_categories = request.cookies.get('categories', '') - cookie_categories = cookie_categories.split(',') + cookie_categories = request.preferences.get_value('categories') for ccateg in cookie_categories: if ccateg in categories: self.categories.append(ccateg) 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: |