[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> </div>
{% endfor %} {% endfor %}
</p> </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> </form>

View file

@ -83,7 +83,6 @@ def index():
selected_engines.extend(x.name for x in categories['general']) selected_engines.extend(x.name for x in categories['general'])
query = request.form['q'].encode('utf-8') query = request.form['q'].encode('utf-8')
results = search(query, request, selected_engines) results = search(query, request, selected_engines)
remember_categs = True if 'save' in request.form else False
if request.form.get('format') == 'json': if request.form.get('format') == 'json':
# TODO HTTP headers # TODO HTTP headers
return json.dumps({'query': query, 'results': results}) return json.dumps({'query': query, 'results': results})
@ -94,7 +93,6 @@ def index():
,number_of_results=len(results) ,number_of_results=len(results)
) )
resp = make_response(template) resp = make_response(template)
if remember_categs:
resp.set_cookie('categories', ','.join(selected_categories)) resp.set_cookie('categories', ','.join(selected_categories))
return resp return resp
return render('index.html') return render('index.html')