summaryrefslogtreecommitdiff
path: root/searx
diff options
context:
space:
mode:
authorAdam Tauber <asciimoo@gmail.com>2014-09-06 15:21:29 +0200
committerAdam Tauber <asciimoo@gmail.com>2014-09-06 15:21:29 +0200
commitc23db1b2bfb2c9233816fc378927c49b67eeffaf (patch)
tree32f8d145c594b67aa4ee66ce95dee25fa8c1f778 /searx
parenta288aa322e2f409fe0d39ba610ad9ce77cb5bc5f (diff)
downloadsearxng-c23db1b2bfb2c9233816fc378927c49b67eeffaf.tar.gz
searxng-c23db1b2bfb2c9233816fc378927c49b67eeffaf.zip
[enh] more flexible category selection
Diffstat (limited to 'searx')
-rw-r--r--searx/webapp.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/searx/webapp.py b/searx/webapp.py
index b586aa2d2..42cb42678 100644
--- a/searx/webapp.py
+++ b/searx/webapp.py
@@ -151,12 +151,18 @@ def render(template_name, override_theme=None, **kwargs):
if not 'selected_categories' in kwargs:
kwargs['selected_categories'] = []
+ for arg in request.args:
+ if arg.startswith('category_'):
+ c = arg.split('_', 1)[1]
+ if c in categories:
+ kwargs['selected_categories'].append(c)
+ if not kwargs['selected_categories']:
cookie_categories = request.cookies.get('categories', '').split(',')
for ccateg in cookie_categories:
if ccateg in categories:
kwargs['selected_categories'].append(ccateg)
- if not kwargs['selected_categories']:
- kwargs['selected_categories'] = ['general']
+ if not kwargs['selected_categories']:
+ kwargs['selected_categories'] = ['general']
if not 'autocomplete' in kwargs:
kwargs['autocomplete'] = autocomplete