def __init__(self, faultxml=[], client=None): DynamicObject.__init__(self) Exception.__init__(self) self.code = None self.message = None self.detail = None for node in faultxml: tag = node.tag.split('}')[-1] if tag == 'faultcode': self.code = ns.split(node.text, nsmap=faultxml.nsmap) elif tag == 'Code': self.code = ns.split(node[0].text, nsmap=faultxml.nsmap) elif tag == 'faultstring': self.message = node.text elif tag == 'Reason': self.message = node[0].text elif tag == 'detail' or tag == 'Detail': faultobj = node[0] type = faultobj.get(ET.QName(ns.XSI, 'type')) if not type: type = faultobj.tag try: faultobj = client.factory(type, faultobj) except: pass self.detail = faultobj
import threading import re import urllib2 as u2 from urlparse import urljoin from logging import getLogger log = getLogger(__name__) XSINIL = 1 PROPERTY = 2 ATTRIBUTE = 4 CHOICE = 8 ANY = 16 QUALIFIED = 32 SIMPLE = 64 xsi_type = ET.QName(ns.XSI, 'type') xsi_nil = ET.QName(ns.XSI, 'nil') xsi_nil_true = {xsi_nil: "true"} class SchemaValidationError(Exception): pass class _SchemaLoader: ''' The SchemaLoader is a container for loading and pre-processing XML Schemas. ''' def __init__(self): self.schemas = {}