on master help sign in
webapp.py: use html.escape if cgi.escape is not available

- cgi.escape was removed in python 3.8 - also use html.escape in framalibre.py

commit5e5ff0cbf83fc6929545e1ca3f936a162019a2aa authorlorddavidiii <lorddavidiii@qi0.de> dateSat 16 Nov 2019, 21:05 (7 years ago) parent42d5e2c
2 files changed+8−2
searx/engines/framalibre.py+4−1 searx/webapp.py+4−1
searx/engines/framalibre.py+4−1
@@ -10,7 +10,10 @@
1010 @parse url, title, content, thumbnail, img_src
1111"""
1212
13−from cgi import escape
13+try:
14+ from cgi import escape
15+except:
16+ from html import escape
1417from lxml import html
1518from searx.engines.xpath import extract_text
1619from searx.url_utils import urljoin, urlencode
searx/webapp.py+4−1
@@ -41,7 +41,10 @@ except:
4141 logger.critical("cannot import dependency: pygments")
4242 from sys import exit
4343 exit(1)
44−from cgi import escape
44+try:
45+ from cgi import escape
46+except:
47+ from html import escape
4548from datetime import datetime, timedelta
4649from time import time
4750from werkzeug.contrib.fixers import ProxyFix