aboutsummaryrefslogtreecommitdiff
path: root/mammoth
diff options
context:
space:
mode:
authormessense <messense@icloud.com>2018-09-07 11:30:54 +0800
committermessense <messense@icloud.com>2018-09-10 10:23:04 +0800
commit1599d4ed14fb3d7c7e551c9f6ce3f86d9df17cbd (patch)
tree09f5e5daff7f902c0e02ba85795be49337fe2c73 /mammoth
parentf929ae104ab70e23fba1a13f1cbaac1ba747a4ee (diff)
Use xml.sax.saxutils.escape instead of deprecated cgi.escape
``` /usr/local/lib/python3.6/dist-packages/mammoth/writers/html.py:34: DeprecationWarning: cgi.escape is deprecated, use html.escape instead return cgi.escape(text, quote=True) ```
Diffstat (limited to 'mammoth')
-rw-r--r--mammoth/writers/html.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/mammoth/writers/html.py b/mammoth/writers/html.py
index 7e6ca95..262d79e 100644
--- a/mammoth/writers/html.py
+++ b/mammoth/writers/html.py
@@ -1,9 +1,8 @@
from __future__ import unicode_literals
+from xml.sax.saxutils import escape
from .abc import Writer
-import cgi
-
class HtmlWriter(Writer):
def __init__(self):
@@ -31,7 +30,7 @@ class HtmlWriter(Writer):
def _escape_html(text):
- return cgi.escape(text, quote=True)
+ return escape(text, {'"': "&quot;"})
def _generate_attribute_string(attributes):