summaryrefslogtreecommitdiff
path: root/searx/plugins/self_info.py
diff options
context:
space:
mode:
authorAdam Tauber <asciimoo@gmail.com>2016-11-04 19:38:21 +0100
committerGitHub <noreply@github.com>2016-11-04 19:38:21 +0100
commit51eafdd471fe989accc060f3ebd8efba0d9b6a71 (patch)
treec39ce3ba1bdd8d7f02543b11f5f20ea1ade2d0f5 /searx/plugins/self_info.py
parent142cd870950e25fe4bb8f4b995b861162af9777c (diff)
parent58a6c045c81a84abfb8a29368e7d5453efc5f2fa (diff)
Merge pull request #733 from dalf/searchpy
Search architecture
Diffstat (limited to 'searx/plugins/self_info.py')
-rw-r--r--searx/plugins/self_info.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/searx/plugins/self_info.py b/searx/plugins/self_info.py
index 438274c41..a2aeda98e 100644
--- a/searx/plugins/self_info.py
+++ b/searx/plugins/self_info.py
@@ -28,19 +28,19 @@ p = re.compile('.*user[ -]agent.*', re.IGNORECASE)
# attach callback to the post search hook
# request: flask request object
# ctx: the whole local context of the pre search hook
-def post_search(request, ctx):
- if ctx['search'].pageno > 1:
+def post_search(request, search):
+ if search.search_query.pageno > 1:
return True
- if ctx['search'].query == 'ip':
+ if search.search_query.query == 'ip':
x_forwarded_for = request.headers.getlist("X-Forwarded-For")
if x_forwarded_for:
ip = x_forwarded_for[0]
else:
ip = request.remote_addr
- ctx['search'].result_container.answers.clear()
- ctx['search'].result_container.answers.add(ip)
- elif p.match(ctx['search'].query):
+ search.result_container.answers.clear()
+ search.result_container.answers.add(ip)
+ elif p.match(search.search_query.query):
ua = request.user_agent
- ctx['search'].result_container.answers.clear()
- ctx['search'].result_container.answers.add(ua)
+ search.result_container.answers.clear()
+ search.result_container.answers.add(ua)
return True