diff options
| author | Matej Cotman <cotman.matej@gmail.com> | 2014-03-29 16:45:22 +0100 |
|---|---|---|
| committer | Matej Cotman <cotman.matej@gmail.com> | 2014-03-29 16:50:48 +0100 |
| commit | 32e98967b76df8088a5759c90650ae65808932bc (patch) | |
| tree | 112714c00ef4b4dcc21080ede436cb74ec273c5f /searx/webapp.py | |
| parent | 879bac8adb181593989a132fabd607f50096473a (diff) | |
add optional request with GET method for search and results pages
Diffstat (limited to 'searx/webapp.py')
| -rw-r--r-- | searx/webapp.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/searx/webapp.py b/searx/webapp.py index 1058d9e65..a9de3255e 100644 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -123,6 +123,8 @@ def render(template_name, **kwargs): if not 'autocomplete' in kwargs: kwargs['autocomplete'] = autocomplete + kwargs['method'] = request.cookies.get('method', 'POST') + return render_template(template_name, **kwargs) @@ -295,6 +297,7 @@ def preferences(): selected_categories = [] locale = None autocomplete = '' + method = 'POST' for pd_name, pd in request.form.items(): if pd_name.startswith('category_'): category = pd_name[9:] @@ -309,6 +312,8 @@ def preferences(): pd in (x[0] for x in language_codes)): lang = pd + elif pd_name == 'method': + method = pd elif pd_name.startswith('engine_'): engine_name = pd_name.replace('engine_', '', 1) if engine_name in engines: @@ -348,6 +353,8 @@ def preferences(): max_age=cookie_max_age ) + resp.set_cookie('method', method, max_age=cookie_max_age) + return resp return render('preferences.html', locales=settings['locales'], |