Skip to content

Commit

Permalink
Merge pull request #394 from Infinidat/urnmap
Browse files Browse the repository at this point in the history
Use urn map for attribute resolution from top-level names
  • Loading branch information
Tianhao He committed May 2, 2016
2 parents 841ad99 + f5bfacc commit 350f6c9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pyVmomi/VmomiSupport.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@
# if a.b.c and a.b.d are the nested classes of a.b, then _dependencyMap[a.b] = {c,d}
_dependencyMap = {}

# Map top level names to xml namespaces
_urnMap = {"vim": XMLNS_VMODL_BASE, "sms": "urn:sms", "pbm": "urn:pbm"}

## Update the dependency map
# Note: Must be holding the _lazyLock
#
Expand Down Expand Up @@ -250,9 +253,9 @@ def __getattr__(self, attr):
else:
if _CheckForDependency(self.name, attr):
typeObj = LazyModule(name)
elif self.name == "vim":
elif self.name in _urnMap:
try:
typeObj = GetWsdlType(XMLNS_VMODL_BASE, attr)
typeObj = GetWsdlType(_urnMap[self.name], attr)
except:
raise AttributeError(attr)
else:
Expand Down

0 comments on commit 350f6c9

Please sign in to comment.