diff --git a/wstools/Utility.py b/wstools/Utility.py index 251be2d..5037d21 100644 --- a/wstools/Utility.py +++ b/wstools/Utility.py @@ -863,7 +863,7 @@ class ElementProxy(Base, MessageInterface): prefix = 'ns%d' % self._indx try: self._dom.findNamespaceURI(prefix, self._getNode()) - except DOMException, ex: + except DOMException as ex: break return prefix @@ -877,7 +877,7 @@ class ElementProxy(Base, MessageInterface): if node and (node.nodeType == node.ELEMENT_NODE) and \ (nsuri == self._dom.findDefaultNS(node)): return None - except DOMException, ex: + except DOMException as ex: pass if nsuri == XMLNS.XML: return self._xml_prefix @@ -928,7 +928,7 @@ class ElementProxy(Base, MessageInterface): def getPrefix(self, namespaceURI): try: prefix = self._getPrefix(node=self.node, nsuri=namespaceURI) - except NamespaceError, ex: + except NamespaceError as ex: prefix = self._getUniquePrefix() self.setNamespaceAttribute(prefix, namespaceURI) return prefix @@ -1025,7 +1025,7 @@ class ElementProxy(Base, MessageInterface): if namespaceURI: try: prefix = self.getPrefix(namespaceURI) - except KeyError, ex: + except KeyError as ex: prefix = 'ns2' self.setNamespaceAttribute(prefix, namespaceURI) qualifiedName = localName diff --git a/wstools/XMLSchema.py b/wstools/XMLSchema.py index 7da3712..bd4f39f 100644 --- a/wstools/XMLSchema.py +++ b/wstools/XMLSchema.py @@ -289,7 +289,7 @@ class DOMAdapter(DOMAdapterInterface): else: try: namespace = DOM.findNamespaceURI(prefix, self.__node) - except DOMException, ex: + except DOMException as ex: if prefix != 'xml': raise SchemaError('%s namespace not declared for %s' % (prefix, self.__node._get_tagName())) namespace = XMLNS.XML @@ -629,7 +629,7 @@ class XMLSchemaComponent(XMLBase, MarkerInterface): if parent.targetNamespace == namespace: try: obj = getattr(parent, collection)[name] - except KeyError, ex: + except KeyError as ex: raise KeyError('targetNamespace(%s) collection(%s) has no item(%s)' % (namespace, collection, name)) return obj @@ -662,7 +662,7 @@ class XMLSchemaComponent(XMLBase, MarkerInterface): try: obj = getattr(schema, collection)[name] - except KeyError, ex: + except KeyError as ex: raise KeyError('targetNamespace(%s) collection(%s) has no item(%s)' % (namespace, collection, name)) return obj @@ -1228,13 +1228,13 @@ class XMLSchema(XMLSchemaComponent): slocd[import_ns] = schema try: tp.loadSchema(schema) - except NoSchemaLocationWarning, ex: + except NoSchemaLocationWarning as ex: # Dependency declaration, hopefully implementation # is aware of this namespace (eg. SOAP,WSDL,?) self.logger.debug("IMPORT: %s : %s" % (import_ns, ex)) del slocd[import_ns] continue - except SchemaError, ex: + except SchemaError as ex: #warnings.warn(\ # ', %s'\ # %(import_ns, 'failed to load schema instance')