summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Tauber <asciimoo@gmail.com>2017-11-23 17:42:34 +0100
committerAdam Tauber <asciimoo@gmail.com>2017-11-23 17:42:52 +0100
commitf65f90bf3cee783d3e9f4e980a3aabc1db213d92 (patch)
treec770f3699e380c35ab7edd01ed89adcd4b638e73
parentfe6e87a5a48136e7dc4567cde60826cd155eeb4f (diff)
downloadsearxng-f65f90bf3cee783d3e9f4e980a3aabc1db213d92.tar.gz
searxng-f65f90bf3cee783d3e9f4e980a3aabc1db213d92.zip
[fix] autocompleter py3 compatibility - fixes #1088
-rw-r--r--searx/webapp.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/searx/webapp.py b/searx/webapp.py
index 371fb2a31..abbbce950 100644
--- a/searx/webapp.py
+++ b/searx/webapp.py
@@ -88,6 +88,9 @@ except:
if sys.version_info[0] == 3:
unicode = str
+ PY3 = True
+else:
+ PY3 = False
# serve pages with HTTP/1.1
from werkzeug.serving import WSGIRequestHandler
@@ -605,7 +608,10 @@ def autocompleter():
disabled_engines = request.preferences.engines.get_disabled()
# parse query
- raw_text_query = RawTextQuery(request.form.get('q', u'').encode('utf-8'), disabled_engines)
+ if PY3:
+ raw_text_query = RawTextQuery(request.form.get('q', b''), disabled_engines)
+ else:
+ raw_text_query = RawTextQuery(request.form.get('q', u'').encode('utf-8'), disabled_engines)
raw_text_query.parse_query()
# check if search query is set