[Zope-CVS] CVS: Packages/WebService - Utility.py:1.3 WSDLTools.py:1.3 XMLSchema.py:1.4 todo.txt:1.3
Brian Lloyd
brian@digicool.com
Fri, 30 Nov 2001 10:32:40 -0500
Update of /cvs-repository/Packages/WebService
In directory cvs.zope.org:/tmp/cvs-serv31552
Modified Files:
Utility.py WSDLTools.py XMLSchema.py todo.txt
Log Message:
Minor cleanups, bug fixes and doc updates.
=== Packages/WebService/Utility.py 1.2 => 1.3 ===
from StringIO import StringIO
from Transports import urlopen
-import xml.dom.minidom
-import weakref
+import xml.dom.minidom, weakref
class DOM:
@@ -404,10 +403,8 @@
nsuri = self.findDefaultNS(element)
return (nsuri, parts[1])
-
-
def importNode(self, document, node, deep=0):
- """Implements (well enough for our purposes) DOM 2 importNode."""
+ """Implements (well enough for our purposes) DOM node import."""
nodetype = node.nodeType
if nodetype in (node.DOCUMENT_NODE, node.DOCUMENT_TYPE_NODE):
raise DOMException('Illegal node type for importNode')
=== Packages/WebService/WSDLTools.py 1.2 => 1.3 ===
from XMLSchema import XMLSchema
from XMLWriter import XMLWriter
-from Transports import urlopen
from StringIO import StringIO
-from urllib import basejoin
-import md5
+import md5, urllib
class WSDLReader:
@@ -33,9 +31,7 @@
def loadFromURL(self, url, checksum=None):
"""Return a WSDL instance loaded from the given url."""
- file = urlopen(url)
- try: document = DOM.loadDocument(file)
- finally: file.close()
+ document = DOM.loadFromURL(url)
wsdl = WSDL()
wsdl.location = url
wsdl.load(document)
@@ -54,7 +50,7 @@
return wsdl
def checkMd5Hash(self, wsdl, value):
- if value is not None and wsdl.getMd5Hash() != required:
+ if value is not None and wsdl.getMd5Hash() != value:
raise WSDLError(
'WSDL checksum does not match required value.'
)
@@ -313,7 +309,7 @@
# Sort-of support relative locations to simplify unit testing. The
# WSDL specification actually doesn't allow relative URLs, so its
# ok that this only works with urls relative to the initial document.
- location = basejoin(self.location, location)
+ location = urllib.basejoin(self.location, location)
obimport = self.addImport(namespace, location)
obimport._loaded = 1
@@ -330,10 +326,8 @@
'Import target element not found for: %s' % location
)
- imported_tns = DOM.getAttr(imported, 'targetNamespace')
- importer_tns = namespace
-
- if imported_tns != importer_tns:
+ imported_tns = DOM.findTargetNS(imported)
+ if imported_tns != namespace:
return
if imported.localName == 'definitions':
@@ -346,7 +340,7 @@
continue
child = DOM.importNode(document, node, 1)
parent.appendChild(child)
- child.setAttribute('targetNamespace', importer_tns)
+ child.setAttribute('targetNamespace', namespace)
attrsNS = imported._attrsNS
for attrkey in attrsNS.keys():
if attrkey[0] == DOM.NS_XMLNS:
=== Packages/WebService/XMLSchema.py 1.3 => 1.4 ===
import string, types, base64, re
from Utility import DOM, Collection
-from Transports import urlopen
from StringIO import StringIO
-from urllib import basejoin
class SchemaReader:
@@ -30,10 +28,9 @@
def loadFromURL(self, url):
"""Return an XMLSchema instance loaded from the given url."""
- file = urlopen(url)
- try: document = DOM.loadDocument(file)
- finally: file.close()
+ document = DOM.loadFromURL(url)
schema = XMLSchema()
+ schema.location = url
schema.load(document)
return schema
@@ -144,7 +141,7 @@
# Sort-of support relative locations to simplify unit testing. The
# WSDL specification actually doesn't allow relative URLs, so its
# ok that this only works with urls relative to the initial document.
- location = basejoin(self.location, location)
+ location = urllib.basejoin(self.location, location)
obimport = self.addImport(namespace, location)
obimport._loaded = 1
=== Packages/WebService/todo.txt 1.2 => 1.3 ===
- implement client interop test suite + reports
- - add copyright / legal mumbo jumbo to files
-
- finish MIME part handling in SOAPMessage
- - speed tweaks for WSDL parsing
-
- - see if HTTPS works with timeouts
-
-
+ - speed / memory tweaks for WSDL parsing
- decide if WSDL really needs to keep DOM document /
loss of ns in wsdl on read / change?