mirror of https://github.com/searx/searx
[mod] check time_range parameter in searx/webadapter.py
This commit is contained in:
parent
2929495112
commit
eecfff2689
|
@ -69,7 +69,7 @@ class SearchQuery:
|
||||||
self.lang = lang
|
self.lang = lang
|
||||||
self.safesearch = safesearch
|
self.safesearch = safesearch
|
||||||
self.pageno = pageno
|
self.pageno = pageno
|
||||||
self.time_range = None if time_range in ('', 'None', None) else time_range
|
self.time_range = time_range
|
||||||
self.timeout_limit = timeout_limit
|
self.timeout_limit = timeout_limit
|
||||||
self.preferences = preferences
|
self.preferences = preferences
|
||||||
self.external_bang = external_bang
|
self.external_bang = external_bang
|
||||||
|
|
|
@ -64,7 +64,8 @@ def get_search_query_from_webapp(preferences, form):
|
||||||
query_time_range = form.get('time_range')
|
query_time_range = form.get('time_range')
|
||||||
|
|
||||||
# check time_range
|
# check time_range
|
||||||
if query_time_range not in ('None', None, '', 'day', 'week', 'month', 'year'):
|
query_time_range = None if query_time_range in ('', 'None') else query_time_range
|
||||||
|
if query_time_range not in (None, 'day', 'week', 'month', 'year'):
|
||||||
raise SearxParameterException('time_range', query_time_range)
|
raise SearxParameterException('time_range', query_time_range)
|
||||||
|
|
||||||
# query_engines
|
# query_engines
|
||||||
|
|
Loading…
Reference in New Issue