From 52e615dede8538c36f569d2cf07835427a9a0db6 Mon Sep 17 00:00:00 2001 From: Adam Tauber Date: Wed, 30 Nov 2016 18:43:03 +0100 Subject: [enh] py3 compatibility --- searx/query.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'searx/query.py') diff --git a/searx/query.py b/searx/query.py index b8b1c0d2f..828a6fb30 100644 --- a/searx/query.py +++ b/searx/query.py @@ -21,8 +21,12 @@ from searx.languages import language_codes from searx.engines import ( categories, engines, engine_shortcuts ) -import string import re +import string +import sys + +if sys.version_info[0] == 3: + unicode = str VALID_LANGUAGE_CODE = re.compile(r'^[a-z]{2,3}(-[a-zA-Z]{2})?$') @@ -146,7 +150,7 @@ class SearchQuery(object): """container for all the search parameters (query, language, etc...)""" def __init__(self, query, engines, categories, lang, safesearch, pageno, time_range): - self.query = query + self.query = query.encode('utf-8') self.engines = engines self.categories = categories self.lang = lang -- cgit v1.2.3-54-g00ecf