Browse Source

----------------------------------------------------------------------

Modified Files:
 	XMLSchema.py -- added some code to generate user interpretable
          exceptions.



BEFORE:

  File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/ZSI/wstools/Utility.py", line 600, in __getitem__
    return self.data[key]
KeyError: u'xtvd'

AFTER:
  File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/ZSI/wstools/XMLSchema.py", line 465, in getQNameAttribute
    raise KeyError, "targetNamespace(%s) collection(%s) has no item(%s)"\
KeyError: u'targetNamespace(urn:TMSWebServices) collection(types) has no item(xtvd)'


 ----------------------------------------------------------------------
main
Joshua Boverhof 20 years ago
parent
commit
3bb0aed073
1 changed files with 16 additions and 5 deletions
  1. +16
    -5
      XMLSchema.py

+ 16
- 5
XMLSchema.py View File

@@ -456,11 +456,22 @@ class XMLSchemaComponent(XMLBase, MarkerInterface):
tdc = self.attributes.get(attribute) tdc = self.attributes.get(attribute)
if tdc: if tdc:
parent = GetSchema(self) parent = GetSchema(self)
if parent.targetNamespace == tdc.getTargetNamespace():
obj = getattr(parent, collection)[tdc.getName()]
elif parent.imports.has_key(tdc.getTargetNamespace()):
schema = parent.imports[tdc.getTargetNamespace()].getSchema()
obj = getattr(schema, collection)[tdc.getName()]
targetNamespace = tdc.getTargetNamespace()
if parent.targetNamespace == targetNamespace:
item = tdc.getName()
try:
obj = getattr(parent, collection)[item]
except KeyError, ex:
raise KeyError, "targetNamespace(%s) collection(%s) has no item(%s)"\
%(targetNamespace, collection, item)
elif parent.imports.has_key(targetNamespace):
schema = parent.imports[targetNamespace].getSchema()
item = tdc.getName()
try:
obj = getattr(schema, collection)[item]
except KeyError, ex:
raise KeyError, "targetNamespace(%s) collection(%s) has no item(%s)"\
%(targetNamespace, collection, item)
return obj return obj


def getXMLNS(self, prefix=None): def getXMLNS(self, prefix=None):


Loading…
Cancel
Save