[enh] preferences redirection

This commit is contained in:
asciimoo 2014-01-01 23:04:13 +01:00
parent fbe5fc3986
commit d2898b0818

View File

@ -22,7 +22,7 @@ if __name__ == "__main__":
from sys import path from sys import path
path.append(os.path.realpath(os.path.dirname(os.path.realpath(__file__))+'/../')) path.append(os.path.realpath(os.path.dirname(os.path.realpath(__file__))+'/../'))
from flask import Flask, request, render_template, url_for, Response, make_response from flask import Flask, request, render_template, url_for, Response, make_response, redirect
from searx.engines import search, categories, engines, get_engines_stats from searx.engines import search, categories, engines, get_engines_stats
from searx import settings from searx import settings
import json import json
@ -151,8 +151,7 @@ def preferences():
continue continue
selected_categories.append(category) selected_categories.append(category)
if selected_categories: if selected_categories:
template = render('preferences.html', selected_categories=selected_categories) resp = make_response(redirect('/'))
resp = make_response(template)
resp.set_cookie('categories', ','.join(selected_categories)) resp.set_cookie('categories', ','.join(selected_categories))
return resp return resp
return render('preferences.html') return render('preferences.html')