on master help sign in
webapp.py: use html.escape if cgi.escape is not available
5e5ff0clorddavidiii
searx/engines/framalibre.py+4−1
@@ -10,7 +10,10 @@
10 @parse url, title, content, thumbnail, img_src
10 @parse url, title, content, thumbnail, img_src
11"""
11"""
12
12
13+try:
13−from cgi import escape
14+ from cgi import escape
15+except:
16+ from html import escape
14from lxml import html
17from lxml import html
15from searx.engines.xpath import extract_text
18from searx.engines.xpath import extract_text
16from searx.url_utils import urljoin, urlencode
19from searx.url_utils import urljoin, urlencode
searx/webapp.py+4−1
@@ -41,7 +41,10 @@ except:
41 logger.critical("cannot import dependency: pygments")
41 logger.critical("cannot import dependency: pygments")
42 from sys import exit
42 from sys import exit
43 exit(1)
43 exit(1)
44+try:
44−from cgi import escape
45+ from cgi import escape
46+except:
47+ from html import escape
45from datetime import datetime, timedelta
48from datetime import datetime, timedelta
46from time import time
49from time import time
47from werkzeug.contrib.fixers import ProxyFix
50from werkzeug.contrib.fixers import ProxyFix