[Python-modules-commits] [python-prov] 02/14: Fix deprecated usage of cgi.escape since Python 3.3

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Tue Dec 13 12:39:43 UTC 2016


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch master
in repository python-prov.

commit c4fa1b3953f0793667d0dd4ace35c1c7d3762fa0
Author: Ghislain Antony Vaillant <ghisvail at gmail.com>
Date:   Fri Jul 22 14:49:03 2016 +0100

    Fix deprecated usage of cgi.escape since Python 3.3
---
 prov/dot.py | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/prov/dot.py b/prov/dot.py
index 57adfc3..8e531de 100644
--- a/prov/dot.py
+++ b/prov/dot.py
@@ -17,7 +17,10 @@ from __future__ import (absolute_import, division, print_function,
 __author__ = 'Trung Dong Huynh'
 __email__ = 'trungdong at donggiang.com'
 
-import cgi
+try:
+    from html import escape
+except ImportError:
+    from cgi import escape
 from datetime import datetime
 import pydotplus as pydot
 import six
@@ -175,12 +178,12 @@ def prov_to_dot(bundle, show_nary=True, use_labels=False,
             ann_rows = [ANNOTATION_START_ROW]
             ann_rows.extend(
                 ANNOTATION_ROW_TEMPLATE % (
-                    attr.uri, cgi.escape(six.text_type(attr)),
+                    attr.uri, escape(six.text_type(attr)),
                     ' href=\"%s\"' % value.uri if isinstance(value, Identifier)
                     else '',
-                    cgi.escape(six.text_type(value)
-                               if not isinstance(value, datetime) else
-                               six.text_type(value.isoformat())))
+                    escape(six.text_type(value)
+                           if not isinstance(value, datetime) else
+                           six.text_type(value.isoformat())))
                 for attr, value in attributes
             )
             ann_rows.append(ANNOTATION_END_ROW)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-prov.git



More information about the Python-modules-commits mailing list