From 83c39a565aaf8fba47f6e9e03eb432cac893f9ad Mon Sep 17 00:00:00 2001 From: asciimoo Date: Sat, 19 Oct 2013 19:56:11 +0200 Subject: [PATCH] [enh] category selection remember --- searx/templates/search.html | 1 + searx/webapp.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/searx/templates/search.html b/searx/templates/search.html index e084610ca..ab83d77ec 100644 --- a/searx/templates/search.html +++ b/searx/templates/search.html @@ -6,4 +6,5 @@ {{ category }}: {% endfor %}

+

remember categories:

diff --git a/searx/webapp.py b/searx/webapp.py index 51d910da2..9efb97ee5 100644 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -80,12 +80,14 @@ def index(): selected_engines.extend(x.name for x in categories[ccateg]) query = request.form['q'].encode('utf-8') results = search(query, request, selected_engines) + remember_categs = True if 'save' in request.form else False if request.form.get('format') == 'json': # TODO HTTP headers return json.dumps({'query': query, 'results': results}) template = render('results.html', results=results, q=query.decode('utf-8'), selected_categories=selected_categories) resp = make_response(template) - resp.set_cookie('categories', ','.join(selected_categories)) + if remember_categs: + resp.set_cookie('categories', ','.join(selected_categories)) return resp return render('index.html')