|
@@ -27,6 +27,18 @@ import cStringIO
|
27
|
27
|
import os
|
28
|
28
|
import hashlib
|
29
|
29
|
|
|
30
|
+from searx import logger
|
|
31
|
+logger = logger.getChild('webapp')
|
|
32
|
+
|
|
33
|
+try:
|
|
34
|
+ from pygments import highlight
|
|
35
|
+ from pygments.lexers import get_lexer_by_name
|
|
36
|
+ from pygments.formatters import HtmlFormatter
|
|
37
|
+except:
|
|
38
|
+ logger.critical("cannot import dependency: pygments")
|
|
39
|
+ from sys import exit
|
|
40
|
+ exit(1)
|
|
41
|
+
|
30
|
42
|
from datetime import datetime, timedelta
|
31
|
43
|
from urllib import urlencode
|
32
|
44
|
from werkzeug.contrib.fixers import ProxyFix
|
|
@@ -51,19 +63,9 @@ from searx.https_rewrite import https_url_rewrite
|
51
|
63
|
from searx.search import Search
|
52
|
64
|
from searx.query import Query
|
53
|
65
|
from searx.autocomplete import searx_bang, backends as autocomplete_backends
|
54
|
|
-from searx import logger
|
55
|
|
-try:
|
56
|
|
- from pygments import highlight
|
57
|
|
- from pygments.lexers import get_lexer_by_name
|
58
|
|
- from pygments.formatters import HtmlFormatter
|
59
|
|
-except:
|
60
|
|
- logger.critical("cannot import dependency: pygments")
|
61
|
|
- from sys import exit
|
62
|
|
- exit(1)
|
|
66
|
+from searx.plugins import plugins
|
63
|
67
|
|
64
|
68
|
|
65
|
|
-logger = logger.getChild('webapp')
|
66
|
|
-
|
67
|
69
|
static_path, templates_path, themes =\
|
68
|
70
|
get_themes(settings['themes_path']
|
69
|
71
|
if settings.get('themes_path')
|
|
@@ -323,7 +325,10 @@ def index():
|
323
|
325
|
'index.html',
|
324
|
326
|
)
|
325
|
327
|
|
326
|
|
- search.search(request)
|
|
328
|
+ if plugins.call('pre_search', request, locals()):
|
|
329
|
+ search.search(request)
|
|
330
|
+
|
|
331
|
+ plugins.call('post_search', request, locals())
|
327
|
332
|
|
328
|
333
|
for result in search.results:
|
329
|
334
|
|