summaryrefslogtreecommitdiff
path: root/searx/webapp.py
diff options
context:
space:
mode:
authorAdam Tauber <asciimoo@gmail.com>2015-02-09 10:47:40 +0100
committerAdam Tauber <asciimoo@gmail.com>2015-02-09 10:47:40 +0100
commit67df3c516fc380d000f32d43ecb90c0fc32ca46a (patch)
tree0eb983532ab1542a9c0e1efd681604aa7346cd33 /searx/webapp.py
parent5f801d7ea0ee1e4b4bec7f52c45ca3f601fc5cdc (diff)
parent7ac6361b51199ce8b208dcd6e8ba62ec4f652186 (diff)
Merge pull request #220 from pointhi/safesearch
Safesearch
Diffstat (limited to 'searx/webapp.py')
-rw-r--r--searx/webapp.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/searx/webapp.py b/searx/webapp.py
index 253e50486..861f3aa29 100644
--- a/searx/webapp.py
+++ b/searx/webapp.py
@@ -267,6 +267,8 @@ def render(template_name, override_theme=None, **kwargs):
kwargs['method'] = request.cookies.get('method', 'POST')
+ kwargs['safesearch'] = request.cookies.get('safesearch', '1')
+
# override url_for function in templates
kwargs['url_for'] = url_for_theme
@@ -471,6 +473,8 @@ def preferences():
locale = None
autocomplete = ''
method = 'POST'
+ safesearch = '1'
+
for pd_name, pd in request.form.items():
if pd_name.startswith('category_'):
category = pd_name[9:]
@@ -489,6 +493,8 @@ def preferences():
lang = pd
elif pd_name == 'method':
method = pd
+ elif pd_name == 'safesearch':
+ safesearch = pd
elif pd_name.startswith('engine_'):
if pd_name.find('__') > -1:
engine_name, category = pd_name.replace('engine_', '', 1).split('__', 1)
@@ -530,6 +536,8 @@ 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)
resp.set_cookie('theme', theme, max_age=cookie_max_age)