[mod] always remember selected categories

This commit is contained in:
asciimoo 2013-10-20 21:31:06 +02:00
parent ee2a55a859
commit 7aa89ef7c6
2 changed files with 1 additions and 4 deletions

View File

@ -8,5 +8,4 @@
</div>
{% endfor %}
</p>
<p><div class="checkbox_container"><input type="checkbox" id="checkbox_save" name="save" checked="checked" /><label for="checkbox_save" class="cb"></label><label for="checkbox_save">remember categories</label></div></p>
</form>

View File

@ -83,7 +83,6 @@ def index():
selected_engines.extend(x.name for x in categories['general'])
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})
@ -94,8 +93,7 @@ def index():
,number_of_results=len(results)
)
resp = make_response(template)
if remember_categs:
resp.set_cookie('categories', ','.join(selected_categories))
resp.set_cookie('categories', ','.join(selected_categories))
return resp
return render('index.html')