diff options
Diffstat (limited to '3.8_escape.patch')
-rw-r--r-- | 3.8_escape.patch | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/3.8_escape.patch b/3.8_escape.patch new file mode 100644 index 000000000000..635a29bef200 --- /dev/null +++ b/3.8_escape.patch @@ -0,0 +1,44 @@ +From 5e5ff0cbf83fc6929545e1ca3f936a162019a2aa Mon Sep 17 00:00:00 2001 +From: lorddavidiii <lorddavidiii@qi0.de> +Date: Sat, 16 Nov 2019 21:05:08 +0100 +Subject: [PATCH] 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 +--- + searx/engines/framalibre.py | 5 ++++- + searx/webapp.py | 5 ++++- + 2 files changed, 8 insertions(+), 2 deletions(-) + +diff --git a/searx/engines/framalibre.py b/searx/engines/framalibre.py +index 146cdaeec..f3441fa5f 100644 +--- a/searx/engines/framalibre.py ++++ b/searx/engines/framalibre.py +@@ -10,7 +10,10 @@ + @parse url, title, content, thumbnail, img_src + """ + +-from cgi import escape ++try: ++ from cgi import escape ++except: ++ from html import escape + from lxml import html + from searx.engines.xpath import extract_text + from searx.url_utils import urljoin, urlencode +diff --git a/searx/webapp.py b/searx/webapp.py +index 3bb29140a..183bf1975 100644 +--- a/searx/webapp.py ++++ b/searx/webapp.py +@@ -41,7 +41,10 @@ + logger.critical("cannot import dependency: pygments") + from sys import exit + exit(1) +-from cgi import escape ++try: ++ from cgi import escape ++except: ++ from html import escape + from datetime import datetime, timedelta + from time import time + from werkzeug.contrib.fixers import ProxyFix |