rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
for i,what in [ (i, self.ofwhat[i]) for i in range(self.lenofwhat) ]: | for i,what in [ (i, self.ofwhat[i]) for i in range(len(self.ofwhat)) ]: | def parse(self, elt, ps): #if elt.localName != self.pname: # elt = elt.getElementsByTagName(self.pname)[0] self.checkname(elt, ps) if self.type and \ self.checktype(elt, ps) not in [ self.type, (None,None) ]: raise EvaluateException('Struct has wrong type', ps.Backtrace(elt)) href = _find_href(elt) if href: if _chil... |
'\n%sresponse = self.binding.Receive(%sWrapper)' % \ | '\n%sresponse = self.binding.Receive(%sWrapper())' % \ | '\n%sdef %s(self, request):' % \ |
self.initcode.write('\n%skw["aname"] = "%%s" %% name' \ % ID4) | self.initcode.write('\n%skw["aname"] = "%s" %% name' \ % (ID4, self.aname_func("%s"))) | self.initdef.set('\n%sdef __init__(self, name=None, ns=None, **kw):' % (ID2)) |
self.initcode.write("\n%saname = '%%s' %% name" % ID4) | self.initcode.write("\n%saname = '%s' %% name" % (ID4, self.aname_func("%s"))) | def _complexTypecodeLogic( self, typecodelist, tns ): |
id = self.checkref(obj, tag, ns_map) if id == None: return | if typed: id = self.checkref(obj, tag, ns_map) if id == None: return | def dump_list(self, obj, tag, typed = 1, ns_map = {}): if Config.debug: print "In dump_list.", "obj=", obj tag = tag or self.gentag() tag = toXMLname(tag) # convert from SOAP 1.2 XML name encoding |
self.out.append( '<%s %sarrayType="%s[%d]" %stype="%sArray"%s%s%s%s%s%s>\n' % (tag, ens, t, len(data), ins, ens, ndecl, edecl, idecl, self.genroot(ns_map), id, a)) typed = not same_type try: elemsname = obj._elemsname except: elemsname = "item" | if typed: self.out.append( '<%s %sarrayType="%s[%d]" %stype="%sArray"%s%s%s%s%s%s>\n' % (tag, ens, t, len(data), ins, ens, ndecl, edecl, idecl, self.genroot(ns_map), id, a)) if typed: try: elemsname = obj._elemsname except: elemsname = "item" else: elemsname = tag | def dump_list(self, obj, tag, typed = 1, ns_map = {}): if Config.debug: print "In dump_list.", "obj=", obj tag = tag or self.gentag() tag = toXMLname(tag) # convert from SOAP 1.2 XML name encoding |
self.dump(i, elemsname, typed, ns_map) self.out.append('</%s>\n' % tag) | self.dump(i, elemsname, not same_type, ns_map) if typed: self.out.append('</%s>\n' % tag) | def dump_list(self, obj, tag, typed = 1, ns_map = {}): if Config.debug: print "In dump_list.", "obj=", obj tag = tag or self.gentag() tag = toXMLname(tag) # convert from SOAP 1.2 XML name encoding |
if host.find(':'): | if host.find(':') >= 0: | def _call(self, name, *args, **kwargs): """Call the named remote web service method.""" if len(args) and len(kwargs): raise TypeError( 'Use positional or keyword argument only.' ) |
offset = 0, rank = None, asize = 0, elemsname = None): | offset = 0, rank = None, asize = 0, elemsname = None, complexType = 0): | def __init__(self, data = None, name = None, typed = None, attrs = None, offset = 0, rank = None, asize = 0, elemsname = None): |
self.args = ("SOAPpy SOAP Exception", code, string, detail) | self.value = ("SOAPpy SOAP Exception", code, string, detail) | def __init__(self, code="", string="", detail=None): self.args = ("SOAPpy SOAP Exception", code, string, detail) self.code = code self.string = string self.detail = detail |
se = SOAPException(object.faultcode, object.faultstring, object.detail) raise se | if object.faultstring == "Required Header Misunderstood": raise RequiredHeaderMismatch(object.detail) elif object.faultstring == "Method Not Found": raise MethodNotFound(object.detail) elif object.faultstring == "Authorization Failed": raise AuthorizationFailed(object.detail) elif object.faultstring == "Method Failed":... | def simplify(object, level=0): """ Convert the SOAPpy objects and thier contents to simple python types. This function recursively converts the passed 'container' object, and all public subobjects. (Private subobjects have names that start with '_'.) Conversions: - faultType --> raise python exception - arrayType ... |
self.__node = node.documentElement | self.__node = self.__node.documentElement | def loadDocument(self, file): self.__node = DOM.loadDocument(file) if hasattr(self.__node, 'documentElement'): self.__node = node.documentElement |
return str(arg) | s = str(arg) if self.debug: log.msg(s, debug=1) return s | def processResponse(self, arg, **kw): for h in self.handlers: arg = h.processResponse(arg, **kw) return str(arg) |
"""Returns typecodes representing input and output messages | """Returns typecodes representing input and output messages, if request and/or response fails to be generated return None for either or both. | def _getTypeCodes(self, callinfo): """Returns typecodes representing input and output messages callinfo -- WSDLTools.SOAPCallInfo instance describing an operation. """ prefix = None self._resetPrefixDict() if callinfo.use == 'encoded': prefix = self._getPrefix(callinfo.namespace) requestTC = self._getTypeCode(paramete... |
requestTC = self._getTypeCode(parameters=callinfo.getInParameters(), literal=(callinfo.use=='literal')) | try: requestTC = self._getTypeCode(parameters=callinfo.getInParameters(), literal=(callinfo.use=='literal')) except EvaluateException, ex: print "DEBUG: Request Failed to generate --", ex requestTC = None | def _getTypeCodes(self, callinfo): """Returns typecodes representing input and output messages callinfo -- WSDLTools.SOAPCallInfo instance describing an operation. """ prefix = None self._resetPrefixDict() if callinfo.use == 'encoded': prefix = self._getPrefix(callinfo.namespace) requestTC = self._getTypeCode(paramete... |
replyTC = self._getTypeCode(parameters=callinfo.getOutParameters(), literal=(callinfo.use=='literal')) | try: replyTC = self._getTypeCode(parameters=callinfo.getOutParameters(), literal=(callinfo.use=='literal')) except EvaluateException, ex: print "DEBUG: Response Failed to generate --", ex replyTC = None | def _getTypeCodes(self, callinfo): """Returns typecodes representing input and output messages callinfo -- WSDLTools.SOAPCallInfo instance describing an operation. """ prefix = None self._resetPrefixDict() if callinfo.use == 'encoded': prefix = self._getPrefix(callinfo.namespace) requestTC = self._getTypeCode(paramete... |
request = TC.Struct(pyclass=None, ofwhat=requestTC, pname=callinfo.methodName) response = TC.Struct(pyclass=None, ofwhat=replyTC, pname='%sResponse' %callinfo.methodName) | if requestTC: request = TC.Struct(pyclass=None, ofwhat=requestTC, pname=callinfo.methodName) if replyTC: response = TC.Struct(pyclass=None, ofwhat=replyTC, pname='%sResponse' %callinfo.methodName) | def _getTypeCodes(self, callinfo): """Returns typecodes representing input and output messages callinfo -- WSDLTools.SOAPCallInfo instance describing an operation. """ prefix = None self._resetPrefixDict() if callinfo.use == 'encoded': prefix = self._getPrefix(callinfo.namespace) requestTC = self._getTypeCode(paramete... |
request = requestTC[0] response = replyTC[0] | if requestTC: request = requestTC[0] if replyTC: response = replyTC[0] | def _getTypeCodes(self, callinfo): """Returns typecodes representing input and output messages callinfo -- WSDLTools.SOAPCallInfo instance describing an operation. """ prefix = None self._resetPrefixDict() if callinfo.use == 'encoded': prefix = self._getPrefix(callinfo.namespace) requestTC = self._getTypeCode(paramete... |
if prefix and callinfo.use == 'encoded': | if request and prefix and callinfo.use == 'encoded': | def _getTypeCodes(self, callinfo): """Returns typecodes representing input and output messages callinfo -- WSDLTools.SOAPCallInfo instance describing an operation. """ prefix = None self._resetPrefixDict() if callinfo.use == 'encoded': prefix = self._getPrefix(callinfo.namespace) requestTC = self._getTypeCode(paramete... |
self._wsdl.types[namespaceURI].getTypeDefinition(localName) typeClass = self._getElement() tc = typeClass(name) | tp = self._wsdl.types[namespaceURI].types[localName] tc = self._getType(tp, name, literal, local=True, namespaceURI=namespaceURI) else: tc = typeClass(name) | def _getTypeCode(self, parameters, literal=False): """Returns typecodes representing a parameter set parameters -- list of WSDLTools.ParameterInfo instances representing the parts of a WSDL Message. """ ofwhat = [] for part in parameters: namespaceURI,localName = part.type |
ofwhat = [] | def _getElement(self, element, literal=False, local=False, namespaceURI=None): """Returns a typecode instance representing the passed in element. element -- XMLSchema.ElementDeclaration instance literal -- literal encoding? local -- is locally defined? namespaceURI -- namespace """ if not element.isElement(): raise Typ... | |
return self._getType(tp, elementName, literal, local, namespaceURI) def _getType(self, tp, name, literal, local, namespaceURI): """Returns a typecode instance representing the passed in type and name. tp -- XMLSchema.TypeDefinition instance name -- element name literal -- literal encoding? local -- is locally defined?... | def _getElement(self, element, literal=False, local=False, namespaceURI=None): """Returns a typecode instance representing the passed in element. element -- XMLSchema.ElementDeclaration instance literal -- literal encoding? local -- is locally defined? namespaceURI -- namespace """ if not element.isElement(): raise Typ... | |
raise EvaluationError, 'only supporting complexType definition' | raise EvaluateException, 'only supporting complexType definition' | def _getElement(self, element, literal=False, local=False, namespaceURI=None): """Returns a typecode instance representing the passed in element. element -- XMLSchema.ElementDeclaration instance literal -- literal encoding? local -- is locally defined? namespaceURI -- namespace """ if not element.isElement(): raise Typ... |
raise EvaluationError, 'only supporting a model group, no derivations' | raise EvaluateException, 'only supporting a model group, no derivations' | def _getElement(self, element, literal=False, local=False, namespaceURI=None): """Returns a typecode instance representing the passed in element. element -- XMLSchema.ElementDeclaration instance literal -- literal encoding? local -- is locally defined? namespaceURI -- namespace """ if not element.isElement(): raise Typ... |
tc = TC.Struct(pyclass=None, ofwhat=ofwhat, pname=elementName) | tc = TC.Struct(pyclass=None, ofwhat=ofwhat, pname=name) | def _getElement(self, element, literal=False, local=False, namespaceURI=None): """Returns a typecode instance representing the passed in element. element -- XMLSchema.ElementDeclaration instance literal -- literal encoding? local -- is locally defined? namespaceURI -- namespace """ if not element.isElement(): raise Typ... |
return self.port.getBinding().getPortType().operations.get(self.name) | return self.port.operations.get(self.name) | def getOperation(self): return self.port.getBinding().getPortType().operations.get(self.name) |
return self.port.getBinding().get(self.name) | return self.port.get(self.name) | def getBOperation(self): return self.port.getBinding().get(self.name) |
if typed: | if kw.get('typed', self.typed): | def cb(self, sw, pyobj, name=None, **kw): if not self.mutable and sw.Known(pyobj): return objid = '%x' % id(pyobj) n = name or self.oname or ('E' + objid) if self.inline: print >>sw, '<%s>' % n else: if typed: attrtext = ' xmlns="%s" xsi:type="%s"' % (self.type[0], self.type[1]) else: attrtext = '' print >>sw, '<%s %si... |
_find_default_namespace = lambda E: E.getAttributeNS(None, 'xmlns') | _find_default_namespace = lambda E: E.getAttributeNS(_XMLNS.BASE, None) | def _find_attrNodeNS(E, namespaceURI, localName): '''Must grab the attribute Node to distinquish between an unspecified attribute(None) and one set to empty string(""). namespaceURI localName ''' attr = E.getAttributeNodeNS(namespaceURI, localName) if attr is None: return None try: return attr.value except: pass return... |
resp = buildSOAP(faultType("%s:Client" % NS.ENV_T, "No method %s found" % nsmethod, "%s %s" % tuple(sys.exc_info()[0:2])), encoding = self.server.encoding, config = self.server.config) | info = sys.exc_info() try: resp = buildSOAP(faultType("%s:Client" % NS.ENV_T, "No method %s found" % nsmethod, "%s %s" % tuple(info[0:2])), encoding = self.server.encoding, config = self.server.config) finally: del info | def do_POST(self): global _contexts status = 500 try: if self.server.config.dumpHeadersIn: s = 'Incoming HTTP headers' debugHeader(s) print self.raw_requestline.strip() print "\n".join(map (lambda x: x.strip(), self.headers.headers)) debugFooter(s) |
if self.server.config.dumpFaultInfo: s = 'Method %s exception' % nsmethod debugHeader(s) traceback.print_exception(info[0], info[1], info[2]) debugFooter(s) if isinstance(e, faultType): f = e else: f = faultType("%s:Server" % NS.ENV_T, "Method %s failed." % nsmethod) if self.server.config.returnFaultInfo: f._setDetai... | try: if self.server.config.dumpFaultInfo: s = 'Method %s exception' % nsmethod debugHeader(s) traceback.print_exception(info[0], info[1], info[2]) debugFooter(s) if isinstance(e, faultType): f = e else: f = faultType("%s:Server" % NS.ENV_T, "Method %s failed." % nsmethod) if self.server.config.returnFaultInfo: f._set... | def do_POST(self): global _contexts status = 500 try: if self.server.config.dumpHeadersIn: s = 'Incoming HTTP headers' debugHeader(s) print self.raw_requestline.strip() print "\n".join(map (lambda x: x.strip(), self.headers.headers)) debugFooter(s) |
elif not hasattr(f, 'detail'): f._setDetail("%s %s" % (info[0], info[1])) | elif not hasattr(f, 'detail'): f._setDetail("%s %s" % (info[0], info[1])) finally: del info | def do_POST(self): global _contexts status = 500 try: if self.server.config.dumpHeadersIn: s = 'Incoming HTTP headers' debugHeader(s) print self.raw_requestline.strip() print "\n".join(map (lambda x: x.strip(), self.headers.headers)) debugFooter(s) |
if self.server.config.dumpFaultInfo: s = 'Received fault exception' debugHeader(s) traceback.print_exception(info[0], info[1], info[2]) debugFooter(s) if self.server.config.returnFaultInfo: e._setDetail("".join(traceback.format_exception( info[0], info[1], info[2]))) elif not hasattr(e, 'detail'): e._setDetail("%s %s"... | try: if self.server.config.dumpFaultInfo: s = 'Received fault exception' debugHeader(s) traceback.print_exception(info[0], info[1], info[2]) debugFooter(s) if self.server.config.returnFaultInfo: e._setDetail("".join(traceback.format_exception( info[0], info[1], info[2]))) elif not hasattr(e, 'detail'): e._setDetail("%... | def do_POST(self): global _contexts status = 500 try: if self.server.config.dumpHeadersIn: s = 'Incoming HTTP headers' debugHeader(s) print self.raw_requestline.strip() print "\n".join(map (lambda x: x.strip(), self.headers.headers)) debugFooter(s) |
traceback.print_exception(info[0], info[1], info[2]) | try: traceback.print_exception(info[0], info[1], info[2]) finally: del info | def do_POST(self): global _contexts status = 500 try: if self.server.config.dumpHeadersIn: s = 'Incoming HTTP headers' debugHeader(s) print self.raw_requestline.strip() print "\n".join(map (lambda x: x.strip(), self.headers.headers)) debugFooter(s) |
v[what.aname] = v[what.aname].append(value) | v[what.aname].append(value) | def parse(self, elt, ps): #if elt.localName != self.pname: # elt = elt.getElementsByTagName(self.pname)[0] self.checkname(elt, ps) if self.type and \ self.checktype(elt, ps) not in [ self.type, (None,None) ]: raise EvaluateException('Struct has wrong type', ps.Backtrace(elt)) href = _find_href(elt) if href: if _chil... |
def hasattr(self, attr): | def hasattr(self, attr, ns=None): | def hasattr(self, attr): """return true if node has attribute attr - attribute to check for """ raise NotImplementedError, 'adapter method not implemented' |
attr - attribute to check for | attr -- attribute to check for ns -- namespace of attribute, by default None | def hasattr(self, attr): """return true if node has attribute attr - attribute to check for """ raise NotImplementedError, 'adapter method not implemented' |
def hasattr(self, attr): """XXX assuming all xsd attributes not prefixed, all others are. Should ask xmlInterface so it can take care namespace mapping for prefixed attributes | def hasattr(self, attr, ns=None): """attr -- attribute ns -- optional namespace, None means unprefixed attribute. | def hasattr(self, attr): """XXX assuming all xsd attributes not prefixed, all others are. Should ask xmlInterface so it can take care namespace mapping for prefixed attributes """ if not self.__attributes: self.setAttributeDictionary() return self.__attributes.has_key(attr) |
xsd = 'xsd' wsdl = 'wsdl' soap = 'soap' soapenc = 'soapenc' mime = 'mime' http = 'http' | def __str__(self): XMLBase.__rlock.acquire() XMLBase.__indent += 1 tmp = "<" + str(self.__class__) + '>\n' for k,v in self.__dict__.items(): tmp += "%s* %s = %s\n" %(XMLBase.__indent*' ', k, v) XMLBase.__indent -= 1 XMLBase.__rlock.release() return tmp | |
tns = self.attributes[XMLSchemaComponent.xsd].get(targetNamespace) | tns = self.attributes.get(targetNamespace) | def getTargetNamespace(self): """return targetNamespace """ parent = self targetNamespace = 'targetNamespace' tns = self.attributes[XMLSchemaComponent.xsd].get(targetNamespace) while not tns: parent = parent._parent() print parent print parent.attributes[XMLSchemaComponent.xsd] tns = parent.attributes[XMLSchemaComponen... |
print parent print parent.attributes[XMLSchemaComponent.xsd] tns = parent.attributes[XMLSchemaComponent.xsd].get(targetNamespace) | tns = parent.attributes.get(targetNamespace) | def getTargetNamespace(self): """return targetNamespace """ parent = self targetNamespace = 'targetNamespace' tns = self.attributes[XMLSchemaComponent.xsd].get(targetNamespace) while not tns: parent = parent._parent() print parent print parent.attributes[XMLSchemaComponent.xsd] tns = parent.attributes[XMLSchemaComponen... |
tdc = self.attributes[XMLSchemaComponent.xsd].get(attribute) | tdc = self.attributes.get(attribute) | def getQNameAttribute(self, collection, attribute): """returns object instance representing QName --> (namespace,name), or if does not exist return None. attribute -- an information item attribute, with a QName value. collection -- collection in parent Schema instance to search. """ obj = None tdc = self.attributes[XML... |
"""retrieve contents empty string returns 'xmlns' | """deference prefix or by default xmlns, returns namespace. | def getXMLNS(self, prefix=None): """retrieve contents empty string returns 'xmlns' """ parent = self ns = self.attributes[XMLSchemaComponent.xmlns].get(prefix) while not ns: parent = parent._parent() ns = parent.attributes[XMLSchemaComponent.xmlns].get(prefix or XMLSchemaComponent.xmlns_key) return ns |
ns = self.attributes[XMLSchemaComponent.xmlns].get(prefix) | ns = self.attributes[XMLSchemaComponent.xmlns].get(prefix or\ XMLSchemaComponent.xmlns_key) | def getXMLNS(self, prefix=None): """retrieve contents empty string returns 'xmlns' """ parent = self ns = self.attributes[XMLSchemaComponent.xmlns].get(prefix) while not ns: parent = parent._parent() ns = parent.attributes[XMLSchemaComponent.xmlns].get(prefix or XMLSchemaComponent.xmlns_key) return ns |
ns = parent.attributes[XMLSchemaComponent.xmlns].get(prefix or XMLSchemaComponent.xmlns_key) | ns = parent.attributes[XMLSchemaComponent.xmlns].get(prefix or\ XMLSchemaComponent.xmlns_key) | def getXMLNS(self, prefix=None): """retrieve contents empty string returns 'xmlns' """ parent = self ns = self.attributes[XMLSchemaComponent.xmlns].get(prefix) while not ns: parent = parent._parent() ns = parent.attributes[XMLSchemaComponent.xmlns].get(prefix or XMLSchemaComponent.xmlns_key) return ns |
return self.attributes[XMLSchemaComponent.xsd].get(attribute) | return self.attributes.get(attribute) | def getAttribute(self, attribute): """return requested attribute or None """ return self.attributes[XMLSchemaComponent.xsd].get(attribute) |
attribute dictionary is prefix keyed by xml xmlns xsd wsdl soap all other keys are namespace values. """ self.attributes = {XMLSchemaComponent.xsd:{},\ XMLSchemaComponent.xmlns:{}} | structure of attributes dictionary ['xmlns'][xmlns_key] -- xmlns namespace ['xmlns'][prefix] -- declared namespace prefix [namespace][prefix] -- attributes declared in a namespace [attribute] -- attributes w/o prefix, default namespaces do not directly apply to attributes, ie Name can't collide with QName. """ self.a... | def setAttributes(self, node): """Sets up attribute dictionary, checks for required attributes and sets default attribute values. attr is for default attribute values determined at runtime. |
if ns == XMLNS or prefix == XMLSchemaComponent.xml: if not self.attributes.has_key(XMLSchemaComponent.xml): self.attributes[XMLSchemaComponent.xml] = {} self.attributes[XMLSchemaComponent.xml][k] = v elif ns in SCHEMA.XSD_LIST: self.attributes[XMLSchemaComponent.xsd][value] = v elif ns == WSDL.BASE: if not self.attribu... | if not ns: raise if not ns or not self.attributes.has_key(ns): self.attributes[ns] = {} | def setAttributes(self, node): """Sets up attribute dictionary, checks for required attributes and sets default attribute values. attr is for default attribute values determined at runtime. |
self.attributes[XMLSchemaComponent.xsd][value] = v | self.attributes[value] = v | def setAttributes(self, node): """Sets up attribute dictionary, checks for required attributes and sets default attribute values. attr is for default attribute values determined at runtime. |
if self.attributes[XMLSchemaComponent.xsd].has_key(k): prefix, value = SplitQName(self.attributes[XMLSchemaComponent.xsd].get(k)) self.attributes[XMLSchemaComponent.xsd][k] = \ | if self.attributes.has_key(k): prefix, value = SplitQName(self.attributes.get(k)) self.attributes[k] = \ | def setAttributes(self, node): """Sets up attribute dictionary, checks for required attributes and sets default attribute values. attr is for default attribute values determined at runtime. |
if self.attributes[XMLSchemaComponent.xsd].has_key('memberTypes'): qnames = self.attributes[XMLSchemaComponent.xsd]['memberTypes'] | for k in ['memberTypes']: if self.attributes.has_key(k): qnames = self.attributes[k] self.attributes[k] = [] for qname in qnames.split(): prefix, value = SplitQName(qname) self.attributes['memberTypes'].append(\ TypeDescriptionComponent(\ (self.getXMLNS(prefix), value))) | def setAttributes(self, node): """Sets up attribute dictionary, checks for required attributes and sets default attribute values. attr is for default attribute values determined at runtime. |
return node.getContentList(*self.__class__.contents[XMLSchemaComponent.xsd]) | return node.getContentList(*self.__class__.contents['xsd']) | def getContents(self, node): """retrieve xsd contents """ return node.getContentList(*self.__class__.contents[XMLSchemaComponent.xsd]) |
if v and not self.attributes[XMLSchemaComponent.xsd].has_key(k): | if v and not self.attributes.has_key(k): | def __setAttributeDefaults(self): """Looks for default values for unset attributes. If class variable representing attribute is None, then it must be defined as an instance variable. """ for k,v in self.__class__.attributes.items(): if v and not self.attributes[XMLSchemaComponent.xsd].has_key(k): if isinstance(v, type... |
self.attributes[XMLSchemaComponent.xsd][k] = v(self) | self.attributes[k] = v(self) | def __setAttributeDefaults(self): """Looks for default values for unset attributes. If class variable representing attribute is None, then it must be defined as an instance variable. """ for k,v in self.__class__.attributes.items(): if v and not self.attributes[XMLSchemaComponent.xsd].has_key(k): if isinstance(v, type... |
self.attributes[XMLSchemaComponent.xsd][k] = v | self.attributes[k] = v | def __setAttributeDefaults(self): """Looks for default values for unset attributes. If class variable representing attribute is None, then it must be defined as an instance variable. """ for k,v in self.__class__.attributes.items(): if v and not self.attributes[XMLSchemaComponent.xsd].has_key(k): if isinstance(v, type... |
if not self.attributes[XMLSchemaComponent.xsd].has_key(a): | if not self.attributes.has_key(a): | def __checkAttributes(self): """Checks that required attributes have been defined, attributes w/default cannot be required. Checks all defined attributes are legal. """ for a in self.__class__.required: if not self.attributes[XMLSchemaComponent.xsd].has_key(a): raise SchemaError,\ 'class instance %s, missing required... |
for a in self.attributes[XMLSchemaComponent.xsd].keys(): if a not in self.__class__.attributes.keys(): | for a in self.attributes.keys(): if (a != XMLSchemaComponent.xmlns) and\ a not in self.__class__.attributes.keys(): | def __checkAttributes(self): """Checks that required attributes have been defined, attributes w/default cannot be required. Checks all defined attributes are legal. """ for a in self.__class__.required: if not self.attributes[XMLSchemaComponent.xsd].has_key(a): raise SchemaError,\ 'class instance %s, missing required... |
f = lambda k: k.attributes[XMLSchemaComponent.xsd]['name'] ns = lambda k: k.attributes[XMLSchemaComponent.xsd]['namespace'] | f = lambda k: k.attributes['name'] ns = lambda k: k.attributes['namespace'] | def __init__(self, parent=None): """parent -- instance variables: targetNamespace -- schema's declared targetNamespace, or empty string. _imported_schemas -- namespace keyed dict of schema dependencies, if a schema is provided instance will not resolve import statement. _included_schemas -- schemaLocation keyed dict of... |
return self.attributes[XMLSchemaComponent.xsd]['elementFormDefault'] | return self.attributes.get('elementFormDefault') | def getElementFormDefault(self): """return elementFormDefault attribute """ return self.attributes[XMLSchemaComponent.xsd]['elementFormDefault'] |
return self.attributes[XMLSchemaComponent.xsd]['attributeFormDefault'] | return self.attributes.get('attributeFormDefault') | def getAttributeFormDefault(self): """return attributeFormDefault attribute """ return self.attributes[XMLSchemaComponent.xsd]['attributeFormDefault'] |
return self.attributes[XMLSchemaComponent.xsd].get('blockDefault') | return self.attributes.get('blockDefault') | def getBlockDefault(self): """return blockDefault attribute """ return self.attributes[XMLSchemaComponent.xsd].get('blockDefault') |
return self.attributes[XMLSchemaComponent.xsd].get('finalDefault') | return self.attributes.get('finalDefault') | def getFinalDefault(self): """return finalDefault attribute """ return self.attributes[XMLSchemaComponent.xsd].get('finalDefault') |
if self.attributes[XMLSchemaComponent.xsd]['namespace'] == self._parent().attributes[XMLSchemaComponent.xsd]['targetNamespace']: | if self.attributes['namespace'] == self._parent().attributes['targetNamespace']: | def fromDom(self, node): self.setAttributes(node) contents = self.getContents(node) |
schema = self._parent().getImportSchemas().get(self.attributes[XMLSchemaComponent.xsd]['namespace']) | ns = self.attributes['namespace'] schema = self._parent().getImportSchemas().get(ns) | def getSchema(self): """if schema is not defined, first look for a Schema class instance in parent Schema. Else if not defined resolve schemaLocation and create a new Schema class instance, and keep a hard reference. """ if not self._schema: schema = self._parent().getImportSchemas().get(self.attributes[XMLSchemaCompo... |
schema = self._parent()._parent().getImportSchemas().get(self.attributes[XMLSchemaComponent.xsd]['namespace']) | schema = self._parent()._parent().getImportSchemas().get(ns) | def getSchema(self): """if schema is not defined, first look for a Schema class instance in parent Schema. Else if not defined resolve schemaLocation and create a new Schema class instance, and keep a hard reference. """ if not self._schema: schema = self._parent().getImportSchemas().get(self.attributes[XMLSchemaCompo... |
if not self.attributes[XMLSchemaComponent.xsd].has_key('schemaLocation'): raise SchemaError, 'namespace(%s) is unknown'\ %self.attributes[XMLSchemaComponent.xsd]['namespace'] | if not self.attributes.has_key('schemaLocation'): raise SchemaError, 'namespace(%s) is unknown' %ns | def getSchema(self): """if schema is not defined, first look for a Schema class instance in parent Schema. Else if not defined resolve schemaLocation and create a new Schema class instance, and keep a hard reference. """ if not self._schema: schema = self._parent().getImportSchemas().get(self.attributes[XMLSchemaCompo... |
self.attributes[XMLSchemaComponent.xsd]['schemaLocation']) | self.attributes['schemaLocation']) | def getSchema(self): """if schema is not defined, first look for a Schema class instance in parent Schema. Else if not defined resolve schemaLocation and create a new Schema class instance, and keep a hard reference. """ if not self._schema: schema = self._parent().getImportSchemas().get(self.attributes[XMLSchemaCompo... |
obj = None | def getSchemaItem(self, collection, namespace, name): """returns object instance representing namespace, name, or if does not exist return None. namespace -- namespace item defined in. name -- name of item. collection -- collection in parent Schema instance to search. """ obj = None parent = GetSchema(self) if parent.t... | |
raise KeyError, "targetNamespace(%s) collection(%s) has no item(%s)"\ | raise KeyError, 'targetNamespace(%s) collection(%s) has no item(%s)'\ | def getSchemaItem(self, collection, namespace, name): """returns object instance representing namespace, name, or if does not exist return None. namespace -- namespace item defined in. name -- name of item. collection -- collection in parent Schema instance to search. """ obj = None parent = GetSchema(self) if parent.t... |
elif parent.imports.has_key(namespace): schema = parent.imports[namespace].getSchema() if schema is None: raise SchemaError, 'no schema instance for imported namespace (%s).'\ %(namespace) try: obj = getattr(schema, collection)[name] except KeyError, ex: raise KeyError, "targetNamespace(%s) collection(%s) has no item(%... | return obj if not parent.imports.has_key(namespace): return None schema = parent.imports[namespace] if not isinstance(schema, XMLSchema): schema = schema.getSchema() if schema is not None: parent.imports[namespace] = schema if schema is None: raise SchemaError, 'no schema instance for imported namespace (%s).'\ %(n... | def getSchemaItem(self, collection, namespace, name): """returns object instance representing namespace, name, or if does not exist return None. namespace -- namespace item defined in. name -- name of item. collection -- collection in parent Schema instance to search. """ obj = None parent = GetSchema(self) if parent.t... |
self.setAttributes(node) | pnode = node.getParentNode() if pnode: pname = SplitQName(pnode.getTagName())[1] if pname == 'types': attributes = {} self.setAttributes(pnode) attributes.update(self.attributes) self.setAttributes(node) for k,v in attributes['xmlns'].items(): if not self.attributes['xmlns'].has_key(k): self.attributes['xmlns'][k] = v ... | def load(self, node): self.setAttributes(node) self.targetNamespace = self.getTargetNamespace() contents = self.getContents(node) |
attributes -- a flattened list of all attributes, | attributes -- a flat list of all attributes, | def _setAttributes(self, attributes): '''parameters attributes -- a flattened list of all attributes, from this list all items in attribute_typecode_dict will be generated into attrComponents. returns a list of strings representing the attribute_typecode_dict. ''' atd = self.attribute_typecode atd_list = formatted_att... |
self.logger.debug("_setUpElements: %s" %self._item.getItemTrace()) | def _setUpElements(self): """This method ONLY sets up the instance attributes. Dependency instance attribute: mgContent -- expected to be either a complex definition with model group content, a model group, or model group content. TODO: should only support the first two. """ | |
flattened = [] | flat = [] | def _setUpElements(self): """This method ONLY sets up the instance attributes. Dependency instance attribute: mgContent -- expected to be either a complex definition with model group content, a model group, or model group content. TODO: should only support the first two. """ |
flattend = content | flat = content | def _setUpElements(self): """This method ONLY sets up the instance attributes. Dependency instance attribute: mgContent -- expected to be either a complex definition with model group content, a model group, or model group content. TODO: should only support the first two. """ |
flattened.append(c) | flat.append(c) | def _setUpElements(self): """This method ONLY sets up the instance attributes. Dependency instance attribute: mgContent -- expected to be either a complex definition with model group content, a model group, or model group content. TODO: should only support the first two. """ |
for c in flattened: | for c in flat: | def _setUpElements(self): """This method ONLY sets up the instance attributes. Dependency instance attribute: mgContent -- expected to be either a complex definition with model group content, a model group, or model group content. TODO: should only support the first two. """ |
flattened = [] | self.logger.debug("_setTypecodeList(%r): %s" % (self.mgContent, self._item.getItemTrace())) flat = [] | def _setTypecodeList(self): """generates ofwhat content, minOccurs/maxOccurs facet generation. Dependency instance attribute: mgContent -- expected to be either a complex definition with model group content, a model group, or model group content. TODO: should only support the first two. localTypes -- produce local cla... |
content = mg.content | self.logger.debug("ModelGroup(%r) contents(%r): %s" % (mg, mg.content, self._item.getItemTrace())) | def _setTypecodeList(self): """generates ofwhat content, minOccurs/maxOccurs facet generation. Dependency instance attribute: mgContent -- expected to be either a complex definition with model group content, a model group, or model group content. TODO: should only support the first two. localTypes -- produce local cla... |
flattend = content | flat = mg.content | def _setTypecodeList(self): """generates ofwhat content, minOccurs/maxOccurs facet generation. Dependency instance attribute: mgContent -- expected to be either a complex definition with model group content, a model group, or model group content. TODO: should only support the first two. localTypes -- produce local cla... |
flattened.append(c) | flat.append(c) | def _setTypecodeList(self): """generates ofwhat content, minOccurs/maxOccurs facet generation. Dependency instance attribute: mgContent -- expected to be either a complex definition with model group content, a model group, or model group content. TODO: should only support the first two. localTypes -- produce local cla... |
for c in flattened: | self.logger.debug("flat: %r" %flat) for c in flat: | def _setTypecodeList(self): """generates ofwhat content, minOccurs/maxOccurs facet generation. Dependency instance attribute: mgContent -- expected to be either a complex definition with model group content, a model group, or model group content. TODO: should only support the first two. localTypes -- produce local cla... |
self._element = element | self._item = element | def setUp(self, element): # Save for debugging self._element = element self.name = element.getAttribute('name') self.ns = element.getTargetNamespace() |
args = ['Failure processing: %s' %self._element.getItemTrace()] | args = ['Failure processing: %s' %self._item.getItemTrace()] | def _setContent(self): '''GED defines element name, so also define typecode aname ''' try: element = [ '%sclass %s(ElementDeclaration):' % (ID1, self.getClassName()), '%s%s' % (ID2, self.literalTag()), '%s%s' % (ID2, self.schemaTag()), '%s%s' % (ID2, self.simpleConstructor()), '%skw["pname"] = ("%s","%s")' % (ID3, self... |
self._tp = tp | self._item = tp | def setUp(self, tp, empty=False): '''Problematic, loose all model group information. <all>, <choice>, <sequence> .. |
args = ["Failure processing %s" %self._tp.getItemTrace()] | args = ["Failure processing %s" %self._item.getItemTrace()] | def _setContent(self): try: definition = [ '%sclass %s(ZSI.TCcompound.ComplexType, TypeDefinition):' % (ID1, self.getClassName()), '%s%s' % (ID2, self.schemaTag()), '%s%s' % (ID2, self.typeTag()), '%s%s' % (ID2, self.pnameConstructor()), #'%s' % self.getElements(), '%s%s' % (ID3, self.nsuriLogic()), '%sTClist = [%s]'... |
if name not in self.methods.keys(): raise AttributeError, name | if not self.methods.has_key(name): raise AttributeError, name | def __getattr__(self, name): """Set up environment then let parent class handle call. |
class ZSIException(Exceptoin): | class ZSIException(Exception): | def _backtrace(elt, dom): '''Return a "backtrace" from the given element to the DOM root, in XPath syntax. ''' s = '' while elt != dom: name, parent = elt.nodeName, elt.parentNode if parent is None: break matches = [ c for c in _child_elements(parent) if c.nodeName == name ] if len(matches) == 1: s = '/' + name + s els... |
obj = str(obj) | obj = repr(obj) | def dump_float(self, obj, tag, typed = 1, ns_map = {}): if Config.debug: print "In dump_float." tag = tag or self.gentag() |
self.typecode += '\n%sZSI.TC.Struct.__init__(self, %s, [%s], pname=name, aname="%%s" %% name, oname=oname )' %( ID3, message.getName(), tcs ) | self.typecode += '\n%sZSI.TC.Struct.__init__(self, %s, [%s], pname=name, aname="%s" %% name, oname=oname )' %( ID3, message.getName(), tcs, self.aname_func("%s") ) | self.typecode += '\n%sdef __init__(self, name=None, ns=None):'\ %(ID1) |
self.typecode += '\n%s%s.typecode = Struct(%s,[%s], pname=name, aname="%%s" %% name, oname="%%s xmlns=\\"%s\\"" %% name )'\ | self.typecode += '\n%s%s.typecode = Struct(%s,[%s], pname=name, aname="%s" %% name, oname="%%s xmlns=\\"%s\\"" %% name )'\ | self.typecode += '\n%sdef __init__(self, name=None, ns=None): pass' %(ID1) break |
tcs,namespace) | tcs, self.aname_func("%s"), namespace) | self.typecode += '\n%sdef __init__(self, name=None, ns=None): pass' %(ID1) break |
self.basector.set('\n%sZSI.TC.Any.__init__(self,pname=name,aname="%%s" %% name , optional=1,repeatable=1, **kw)' % ID3) | self.basector.set('\n%sZSI.TC.Any.__init__(self,pname=name,aname="%s" %% name , optional=1,repeatable=1, **kw)' % (ID3, self.aname_func("%s")) ) | self.initdef.set('\n%sdef __init__(self, name=None, ns=None, **kw):' % (ID2)) |
self.basector.set('\n\n%s%s.__init__(self,pname=name, aname="%%s" %% name, **kw)' % (ID3,tpc)) | self.basector.set('\n\n%s%s.__init__(self,pname=name, aname="%s" %% name, **kw)' % (ID3,tpc,self.aname_func("%s"))) | self.initdef.set('\n\n%sdef __init__(self, name=None, ns=None, **kw):' \ % ID2) |
"\n%s%s.__init__(self, '%s', %s%s(name=None,typed=0), pname=name, aname='%%s' %% name, oname='%%s xmlns:%s=\"%s\"' %% name, **kw)" %(ID3, tc, arrayType, nsp, atype, atypePrefix, atypeNS) | "\n%s%s.__init__(self, '%s', %s%s(name=None,typed=0), pname=name, aname='%s' %% name, oname='%%s xmlns:%s=\"%s\"' %% name, **kw)" %(ID3, tc, arrayType, nsp, atype, self.aname_func("%s"), atypePrefix, atypeNS) | self.initdef.set("\n%sdef __init__(self, name = None, ns = None, **kw):" % ID2) |
self.dump(self.header, "Header", typed = typed) | header_ns = self.genns(ns_map, NS.ENV)[0] self.dump(self.header, "%sHeader" % header_ns, typed = typed) | def build(self): if Config.debug: print "In build." ns_map = {} |
os.kill(cls._process.pid, signal.SIGKILL) | os.kill(cls._process.pid, signal.SIGKILL) cls._process = None | def CleanUp(cls): if cls._process is None: return os.kill(cls._process.pid, signal.SIGKILL) |
if self._dec.attributes.has_key('name'): return self.mangle(self._dec.attributes['name']) else: return None | if hasattr( self._dec, 'attributes'): if self._dec.attributes.has_key('name'): return self.mangle(self._dec.attributes['name']) return None | def getName(self): """returns name """ if self._dec.attributes.has_key('name'): return self.mangle(self._dec.attributes['name']) else: return None |
meth(obj, tag, typed, ns_map) | def dump(self, obj, tag = None, typed = 1, ns_map = {}): if Config.debug: print "In dump.", "obj=", obj ns_map = ns_map.copy() self.depth += 1 | |
self.dump(obj.aslist(i), obj._keyord[i], 1, ns_map) | self.dump(obj._aslist(i), obj._keyord[i], 1, ns_map) | def dump_instance(self, obj, tag, typed = 1, ns_map = {}): if Config.debug: print "In dump_instance.", "obj=", obj, "tag=", tag if not tag: # If it has a name use it. if isinstance(obj, anyType) and obj._name: tag = obj._name else: tag = self.gentag() |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.