summaryrefslogtreecommitdiff
path: root/searx/webapp.py
diff options
context:
space:
mode:
authorAdam Tauber <asciimoo@gmail.com>2015-03-10 19:55:22 +0100
committerAdam Tauber <asciimoo@gmail.com>2015-03-10 19:55:22 +0100
commit00cc4dcbf44d9ecea89befb08cae4ee5561c4247 (patch)
tree0a9151bd7ee1ac614ccfe69f8ea8a536a139e60c /searx/webapp.py
parent8d1d4819ae53ff33a258e12ab6a2dc5b58e88846 (diff)
downloadsearxng-00cc4dcbf44d9ecea89befb08cae4ee5561c4247.tar.gz
searxng-00cc4dcbf44d9ecea89befb08cae4ee5561c4247.zip
[enh] plugin support basics ++ self ip plugin
Diffstat (limited to 'searx/webapp.py')
-rw-r--r--searx/webapp.py29
1 files changed, 17 insertions, 12 deletions
diff --git a/searx/webapp.py b/searx/webapp.py
index f71df796a..f5d779f15 100644
--- a/searx/webapp.py
+++ b/searx/webapp.py
@@ -27,6 +27,18 @@ import cStringIO
import os
import hashlib
+from searx import logger
+logger = logger.getChild('webapp')
+
+try:
+ from pygments import highlight
+ from pygments.lexers import get_lexer_by_name
+ from pygments.formatters import HtmlFormatter
+except:
+ logger.critical("cannot import dependency: pygments")
+ from sys import exit
+ exit(1)
+
from datetime import datetime, timedelta
from urllib import urlencode
from werkzeug.contrib.fixers import ProxyFix
@@ -51,19 +63,9 @@ from searx.https_rewrite import https_url_rewrite
from searx.search import Search
from searx.query import Query
from searx.autocomplete import searx_bang, backends as autocomplete_backends
-from searx import logger
-try:
- from pygments import highlight
- from pygments.lexers import get_lexer_by_name
- from pygments.formatters import HtmlFormatter
-except:
- logger.critical("cannot import dependency: pygments")
- from sys import exit
- exit(1)
+from searx.plugins import plugins
-logger = logger.getChild('webapp')
-
static_path, templates_path, themes =\
get_themes(settings['themes_path']
if settings.get('themes_path')
@@ -323,7 +325,10 @@ def index():
'index.html',
)
- search.search(request)
+ if plugins.call('pre_search', request, locals()):
+ search.search(request)
+
+ plugins.call('post_search', request, locals())
for result in search.results: