logo

searx

My custom branche(s) on searx, a meta-search engine git clone https://hacktivis.me/git/searx.git
commit: 832ea60e3d19add2ffa857bc420ff33af83aac5c
parent e7de9674b14c2ff06fac009274742819d6468138
Author: Thomas Pointhuber <thomas.pointhuber@gmx.at>
Date:   Sun,  8 Feb 2015 22:01:24 +0100

[fix] pep8, tests

Diffstat:

Msearx/engines/bing_images.py1+
Msearx/engines/blekko_images.py1+
Msearx/tests/engines/test_bing_images.py1+
Msearx/tests/engines/test_blekko_images.py1+
Msearx/webapp.py6+-----
5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/searx/engines/bing_images.py b/searx/engines/bing_images.py @@ -33,6 +33,7 @@ safesearch_types = {2: 'STRICT', 1: 'DEMOTE', 0: 'OFF'} + # do search-request def request(query, params): offset = (params['pageno'] - 1) * 10 + 1 diff --git a/searx/engines/blekko_images.py b/searx/engines/blekko_images.py @@ -25,6 +25,7 @@ safesearch_types = {2: '1', 1: '', 0: '0'} + # do search-request def request(query, params): c = (params['pageno'] - 1) * 48 diff --git a/searx/tests/engines/test_bing_images.py b/searx/tests/engines/test_bing_images.py @@ -12,6 +12,7 @@ class TestBingImagesEngine(SearxTestCase): dicto = defaultdict(dict) dicto['pageno'] = 1 dicto['language'] = 'fr_FR' + dicto['safesearch'] = 1 params = bing_images.request(query, dicto) self.assertTrue('url' in params) self.assertTrue(query in params['url']) diff --git a/searx/tests/engines/test_blekko_images.py b/searx/tests/engines/test_blekko_images.py @@ -10,6 +10,7 @@ class TestBlekkoImagesEngine(SearxTestCase): query = 'test_query' dicto = defaultdict(dict) dicto['pageno'] = 0 + dicto['safesearch'] = 1 params = blekko_images.request(query, dicto) self.assertTrue('url' in params) self.assertTrue(query in params['url']) diff --git a/searx/webapp.py b/searx/webapp.py @@ -457,10 +457,6 @@ def preferences(): Settings that are going to be saved as cookies.""" lang = None image_proxy = request.cookies.get('image_proxy', settings['server'].get('image_proxy')) - try: - savesearch = int(request.cookies.get('savesearch', 1)) - except ValueError: - savesearch = 1 if request.cookies.get('language')\ and request.cookies['language'] in (x[0] for x in language_codes): @@ -539,7 +535,7 @@ def preferences(): ) resp.set_cookie('method', method, max_age=cookie_max_age) - + resp.set_cookie('safesearch', safesearch, max_age=cookie_max_age) resp.set_cookie('image_proxy', image_proxy, max_age=cookie_max_age)