diff options
author | Alexandre Flament <alex@al-f.net> | 2016-11-02 14:52:22 +0100 |
---|---|---|
committer | Alexandre Flament <alex@al-f.net> | 2016-11-02 14:52:22 +0100 |
commit | 58a6c045c81a84abfb8a29368e7d5453efc5f2fa (patch) | |
tree | c39ce3ba1bdd8d7f02543b11f5f20ea1ade2d0f5 /searx/webapp.py | |
parent | fbb080f3588ad43bf896a569257f3a95e1181d7b (diff) | |
download | searxng-58a6c045c81a84abfb8a29368e7d5453efc5f2fa.tar.gz searxng-58a6c045c81a84abfb8a29368e7d5453efc5f2fa.zip |
[mod] replace references request.request_data (GET or POST parameters) by request.form (based on merge of POST and GET parameters)
Diffstat (limited to 'searx/webapp.py')
-rw-r--r-- | searx/webapp.py | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/searx/webapp.py b/searx/webapp.py index 7c3cb7e9b..d3d5bb51e 100644 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -364,16 +364,6 @@ def render(template_name, override_theme=None, **kwargs): @app.before_request def pre_request(): - # request.request_data - if request.method == 'POST': - request_data = request.form - elif request.method == 'GET': - request_data = request.args - else: - request_data = {} - - request.request_data = request_data - # merge GET, POST vars preferences = Preferences(themes, categories.keys(), engines, plugins) try: @@ -416,7 +406,7 @@ def index(): search_query = None result_container = None try: - search_query = get_search_query_from_webapp(request.preferences, request.request_data) + search_query = get_search_query_from_webapp(request.preferences, request.form) # search = Search(search_query) # without plugins search = SearchWithPlugins(search_query, request) result_container = search.search() @@ -428,8 +418,8 @@ def index(): results = result_container.get_ordered_results() # UI - advanced_search = request.request_data.get('advanced_search', None) - output_format = request.request_data.get('format', 'html') + advanced_search = request.form.get('advanced_search', None) + output_format = request.form.get('format', 'html') if output_format not in ['html', 'csv', 'json', 'rss']: output_format = 'html' @@ -490,7 +480,7 @@ def index(): response_rss = render( 'opensearch_response_rss.xml', results=results, - q=request.request_data['q'], + q=request.form['q'], number_of_results=number_of_results, base_url=get_base_url() ) @@ -499,7 +489,7 @@ def index(): return render( 'results.html', results=results, - q=request.request_data['q'], + q=request.form['q'], selected_categories=search_query.categories, pageno=search_query.pageno, time_range=search_query.time_range, @@ -531,7 +521,7 @@ def autocompleter(): disabled_engines = request.preferences.engines.get_disabled() # parse query - raw_text_query = RawTextQuery(request.request_data.get('q', '').encode('utf-8'), disabled_engines) + raw_text_query = RawTextQuery(request.form.get('q', '').encode('utf-8'), disabled_engines) raw_text_query.parse_query() # check if search query is set @@ -564,7 +554,7 @@ def autocompleter(): results.append(raw_text_query.getFullQuery()) # return autocompleter results - if request.request_data.get('format') == 'x-suggestions': + if request.form.get('format') == 'x-suggestions': return Response(json.dumps([raw_text_query.query, results]), mimetype='application/json') |