From f354b1509fd9db5a1758fe238e0bd50cd4499def Mon Sep 17 00:00:00 2001 From: Julien Iguchi-Cartigny Date: Sat, 5 Jul 2014 22:54:24 +0200 Subject: [PATCH] handling StringIO import for python 2 and 3 --- wstools/WSDLTools.py | 6 +++++- wstools/c14n.py | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/wstools/WSDLTools.py b/wstools/WSDLTools.py index 61136c5..c341178 100644 --- a/wstools/WSDLTools.py +++ b/wstools/WSDLTools.py @@ -10,7 +10,11 @@ ident = "$Id$" import weakref -from cStringIO import StringIO +try: + from io import StringIO +except ImportError: + from cStringIO import StringIO + from Namespaces import OASIS, XMLNS, WSA, WSA_LIST, WSAW_LIST, WSRF_V1_2, WSRF from Utility import Collection, CollectionNS, DOM, ElementProxy, basejoin from XMLSchema import XMLSchema, SchemaReader, WSDLToolsAdapter diff --git a/wstools/c14n.py b/wstools/c14n.py index f88160d..462fc4c 100644 --- a/wstools/c14n.py +++ b/wstools/c14n.py @@ -56,7 +56,10 @@ except: BASE = "http://www.w3.org/2000/xmlns/" XML = "http://www.w3.org/XML/1998/namespace" -import io +try: + from io import StringIO +except ImportError: + from cStringIO import StringIO _attrs = lambda E: (E.attributes and list(E.attributes.values())) or [] _children = lambda E: E.childNodes or []