Merge pull request #394 from Infinidat/urnmap

Use urn map for attribute resolution from top-level names
This commit is contained in:
Tianhao He
2016-05-02 09:27:30 -07:00

View File

@@ -78,6 +78,9 @@ _wsdlDefMap = {}
# if a.b.c and a.b.d are the nested classes of a.b, then _dependencyMap[a.b] = {c,d} # if a.b.c and a.b.d are the nested classes of a.b, then _dependencyMap[a.b] = {c,d}
_dependencyMap = {} _dependencyMap = {}
# Map top level names to xml namespaces
_urnMap = {"vim": XMLNS_VMODL_BASE, "sms": "urn:sms", "pbm": "urn:pbm"}
## Update the dependency map ## Update the dependency map
# Note: Must be holding the _lazyLock # Note: Must be holding the _lazyLock
# #
@@ -250,9 +253,9 @@ class LazyModule(object):
else: else:
if _CheckForDependency(self.name, attr): if _CheckForDependency(self.name, attr):
typeObj = LazyModule(name) typeObj = LazyModule(name)
elif self.name == "vim": elif self.name in _urnMap:
try: try:
typeObj = GetWsdlType(XMLNS_VMODL_BASE, attr) typeObj = GetWsdlType(_urnMap[self.name], attr)
except: except:
raise AttributeError(attr) raise AttributeError(attr)
else: else: