summaryrefslogtreecommitdiff
path: root/searx/query.py
diff options
context:
space:
mode:
authorDalf <alex@al-f.net>2020-08-11 16:25:03 +0200
committerAlexandre Flament <alex@al-f.net>2020-09-10 10:49:42 +0200
commitc225db45c8a4ab466bff049216f7e0189dc1b067 (patch)
tree16be3299a6faf15538fc1f2cf181aadc422039fd /searx/query.py
parent78883777438fc07833d983c50d9b131eb6feb9eb (diff)
downloadsearxng-c225db45c8a4ab466bff049216f7e0189dc1b067.tar.gz
searxng-c225db45c8a4ab466bff049216f7e0189dc1b067.zip
Drop Python 2 (4/n): SearchQuery.query is a str instead of bytes
Diffstat (limited to 'searx/query.py')
-rw-r--r--searx/query.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/searx/query.py b/searx/query.py
index 614e05c6b..ef323af7a 100644
--- a/searx/query.py
+++ b/searx/query.py
@@ -32,6 +32,7 @@ class RawTextQuery:
"""parse raw text query (the value from the html input)"""
def __init__(self, query, disabled_engines):
+ assert isinstance(query, str)
self.query = query
self.disabled_engines = []
@@ -51,7 +52,7 @@ class RawTextQuery:
self.query_parts = []
# split query, including whitespaces
- raw_query_parts = re.split(r'(\s+)' if isinstance(self.query, str) else b'(\s+)', self.query)
+ raw_query_parts = re.split(r'(\s+)', self.query)
parse_next = True
@@ -183,7 +184,7 @@ class SearchQuery:
def __init__(self, query, engines, categories, lang, safesearch, pageno, time_range,
timeout_limit=None, preferences=None, external_bang=None):
- self.query = query.encode()
+ self.query = query
self.engines = engines
self.categories = categories
self.lang = lang
@@ -195,4 +196,4 @@ class SearchQuery:
self.external_bang = external_bang
def __str__(self):
- return str(self.query) + ";" + str(self.engines)
+ return self.query + ";" + str(self.engines)