Modified Files: Utility.py WSDLTools.py XMLSchema.py -- Fixed [ 810251 ] default method broken in wstools.Utility.Collection -- Also fixed problem with includes Collection key, and changed Types(Collection) class to declare a different default key instead of redefining several methods. ----------------------------------------------------------------------main
@@ -557,7 +557,7 @@ DOM = DOM() | |||||
class Collection(UserDict): | class Collection(UserDict): | ||||
"""Helper class for maintaining ordered named collections.""" | """Helper class for maintaining ordered named collections.""" | ||||
default = lambda k: k.name | |||||
default = lambda self,k: k.name | |||||
def __init__(self, parent, key=None): | def __init__(self, parent, key=None): | ||||
UserDict.__init__(self) | UserDict.__init__(self) | ||||
self.parent = weakref.ref(parent) | self.parent = weakref.ref(parent) | ||||
@@ -288,6 +288,7 @@ class ImportElement(Element): | |||||
class Types(Collection): | class Types(Collection): | ||||
default = lambda self,k: k.targetNamespace | |||||
def __init__(self, parent): | def __init__(self, parent): | ||||
Collection.__init__(self, parent) | Collection.__init__(self, parent) | ||||
self.documentation = '' | self.documentation = '' | ||||
@@ -298,12 +299,6 @@ class Types(Collection): | |||||
self[name] = schema | self[name] = schema | ||||
return schema | return schema | ||||
def keys(self): | |||||
return map(lambda i: i.targetNamespace, self.list) | |||||
def items(self): | |||||
return map(lambda i: i.targetNamespace, self.list) | |||||
def addExtension(self, item): | def addExtension(self, item): | ||||
self.extensions.append(item) | self.extensions.append(item) | ||||
@@ -824,7 +824,8 @@ class XMLSchema(XMLSchemaComponent): | |||||
XMLSchemaComponent.__init__(self, parent) | XMLSchemaComponent.__init__(self, parent) | ||||
f = lambda k: k.attributes['name'] | f = lambda k: k.attributes['name'] | ||||
ns = lambda k: k.attributes['namespace'] | ns = lambda k: k.attributes['namespace'] | ||||
self.includes = Collection(self, key=f) | |||||
sl = lambda k: k.attributes['schemaLocation'] | |||||
self.includes = Collection(self, key=sl) | |||||
self.imports = Collection(self, key=ns) | self.imports = Collection(self, key=ns) | ||||
self.elements = Collection(self, key=f) | self.elements = Collection(self, key=f) | ||||
self.types = Collection(self, key=f) | self.types = Collection(self, key=f) | ||||