rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
if item: | if item is not None: | def _aslist(self, item=None): if item: return self.__dict__[self._keyord[item]] else: return map( lambda x: self.__dict__[x], self._keyord) |
if item: | if item is not None: | def _asdict(self, item=None, encoding=Config.dict_encoding): if item: if type(item) in (UnicodeType,StringType): item = item.encode(encoding) return self.__dict__[item] else: retval = {} def fun(x): retval[x.encode(encoding)] = self.__dict__[x] |
if item: | if item is not None: | def _aslist(self, item=None): if item: return self.data[int(item)] else: return self.data |
if item: | if item is not None: | def _asdict(self, item=None, encoding=Config.dict_encoding): if item: if type(item) in (UnicodeType,StringType): item = item.encode(encoding) return self.data[int(item)] else: retval = {} def fun(x): retval[str(x).encode(encoding)] = self.data[x] map( fun, range(len(self.data)) ) return retval |
if attr is not None: | if value is not None: | def load(self, document): if document.nodeType == document.DOCUMENT_NODE: schema = DOM.getElement(document, 'schema', None, None) else: schema = document if schema is None: raise SchemaError('Missing <schema> element.') |
start = data.find(original_namespace) stop = data.find('"', start) or data.find('\'', start) return data[start:stop] | pattern="xmlns:\w+=['\"](" + original_namespace + ")['\"]" match = re.search(pattern, data) if match: return match.group(1) else: return original_namespace | def getNS(self, original_namespace, data): # only try this if original_namespace is a string! if type(original_namespace) == StringType: start = data.find(original_namespace) stop = data.find('"', start) or data.find('\'', start) return data[start:stop] else: return original_namespace |
request, response = self._getTypeCodes() binding.Send(url=uri, opname=None, obj=args or kwargs, | request, response = self._getTypeCodes(callinfo) if len(kwargs): args = kwargs binding.Send(url=uri, opname=None, obj=args, | 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.' ) |
def _getTypeCodes(self): requestTC = replyTC = None operation = self._port.getBinding().getPortType().operations[callinfo.methodName] NS_WSDL = DOM.GetWSDLUri(self._wsdl.version) definition = DOM.getElement(node=self._wsdl.document, name='definitions', nsuri=NS_WSDL) for node in DOM.getElements(node=definition, name... | def _getTypeCodes(self, callinfo): requestTC = self._getTypeCode(parameters=callinfo.getInParameters()) replyTC = self._getTypeCode(parameters=callinfo.getOutParameters()) | def _getTypeCodes(self): #XXX This sucks but we need to dereference the prefix, so # we need to track down the representative DOM nodes requestTC = replyTC = None operation = self._port.getBinding().getPortType().operations[callinfo.methodName] |
def _getTypeCode(self, node, parameters): | def _getTypeCode(self, parameters): | def _getTypeCode(self, node, parameters): bti = BaseTypeInterpreter() typeCode = [] for part in parameters: namespaceURI,localName = part.type |
port = portAdapter._port | def checkPort(self, portAdapter, operationName): """Check if test is in correctly indexed in the configuration file, port operation must conform to the bindings. | |
self._section = __name__ | self._section = section | def setSection(self, section): self._section = __name__ |
iw = op.getInput().getMessage().getName() + 'Wrapper' o += '\n%sargs = ps.Parse( %s )' % ( ID2, iw) | o += '\n%sargs = ps.Parse( %s )' % ( ID2, op.getInput().getMessage().getName() + 'Wrapper') | o = '\n%sdef %s(self, ps):' % (ID1, self.getMethodName(op.getName())) |
o += '\n%s%s = %s.%s' % (ID2, a.getName(), iw, a.getName()) | o += '\n%s%s = args.%s' % (ID2, a.getName(), a.getName()) | o = '\n%sdef %s(self, ps):' % (ID1, self.getMethodName(op.getName())) |
structType.__init__(self) | def __init__(self): self.title = "Title of a book" | |
tc = Any.parsemap.get((nsuri,name)) | tc = Any.parsemap.get((nsuri,name)) or Any.parsemap.get((None, name)) | def setMemberTypeCodes(self): if len(self.memberTypeCodes) > 0: return if self.__class__.memberTypes is None: raise EvaluateException, 'uninitialized class variable memberTypes [(namespace,name),]' for nsuri,name in self.__class__.memberTypes: tcclass = GTD(nsuri,name) if tcclass is None: tc = Any.parsemap.get((nsuri,n... |
self.initdef += '\n%sself.ofwhat += self.ofwhat + tuple(TCList)' % ID4 self.initdef += '\n%sself.lenofwhat += self.lenofwhat + len(TCList)' % ID4 | self.initdef += '\n%sself.ofwhat += tuple(TCList)' % ID4 self.initdef += '\n%sself.lenofwhat += len(TCList)' % ID4 | self.initdef += '\n%sself.ofwhat += self.ofwhat + tuple(TCList)' % ID4 |
elif hasattr(self._content.derivation, 'content') and \ hasattr(self._content.derivation.content, 'content') and \ self._content.derivation.content.content: t = self._content.derivation.content.content[0].\ attributes['type'][1] | elif self._content.derivation.attr_content and \ self._content.derivation.attr_content[0].attributes.\ has_key('http://schemas.xmlsoap.org/wsdl/') \ and self._content.derivation.attr_content[0].\ attributes['http://schemas.xmlsoap.org/wsdl/']\ .has_key('arrayType'): t = self._content.derivation.attr_content[0].\ attrib... | def getArrayType(self): |
except Exception: | except: | def Receive(self, replytype=None, **kw): '''Parse message, create Python object. if replytype is None, use TC.Any to dynamically parse; otherwise it can be a Python class or the typecode to use in parsing. ''' self.ReceiveSOAP(**kw) if self.ps.IsAFault(): msg = FaultFromFaultMessage(self.ps) raise TypeError("Unexpected... |
def __init__(self, name): | def __init__(self, name=None): | def __init__(self, name): self.name = name or id(self) self.z = 'z value' |
self.testInst.failUnlessEqual(origLine, testLine) | if origLine != testLine: line = origLine while line and line != self.divider: line = self.origStrFile.readline() self.testInst.failUnlessEqual(origLine, testLine) | def failUnlessEqual(self, buffer): """failUnlessEqual takes either a string or a StringIO instance as input, and compares it against the original output from the test file. """ # if not already a string IO if not isinstance(buffer, StringIO.StringIO): testStrFile = StringIO.StringIO(buffer) else: testStrFile = buffer t... |
testStrFile.close() | def failUnlessEqual(self, buffer): """failUnlessEqual takes either a string or a StringIO instance as input, and compares it against the original output from the test file. """ # if not already a string IO if not isinstance(buffer, StringIO.StringIO): testStrFile = StringIO.StringIO(buffer) else: testStrFile = buffer t... | |
print >>self, self.WARN, self.msg, | print >>self, BasicLogger.WARN, self.msg, | def warning(self, msg, *args): if self.level < 1: return print >>self, self.WARN, self.msg, print >>self, msg %args |
print >>self, self.DEBUG, self.msg, | print >>self, BasicLogger.DEBUG, self.msg, | def debug(self, msg, *args): if self.level < 2: return print >>self, self.DEBUG, self.msg, print >>self, msg %args |
print >>self, self.ERROR, self.msg, | print >>self, BasicLogger.ERROR, self.msg, | def error(self, msg, *args): print >>self, self.ERROR, self.msg, print >>self, msg %args |
BasicLogger.setLevel(1) | BasicLogger.setLevel(WARN) | def setBasicLoggerWARN(): '''Use Basic Logger. ''' setLoggerClass(BasicLogger) BasicLogger.setLevel(1) |
BasicLogger.setLevel(2) | BasicLogger.setLevel(DEBUG) | def setBasicLoggerDEBUG(): '''Use Basic Logger. ''' setLoggerClass(BasicLogger) BasicLogger.setLevel(2) |
namespace = XMLNS | namespace = XMLNS.XML | def getNamespace(self, prefix): """prefix -- deference namespace prefix in node's context. Ascends parent nodes until found. """ namespace = None if prefix == 'xmlns': namespace = DOM.findDefaultNS(prefix, self.__node) else: try: namespace = DOM.findNamespaceURI(prefix, self.__node) except DOMException, ex: if prefix !... |
class XMLSchemaComponent(XMLBase): | class XMLSchemaComponent(XMLBase, MarkerInterface): | 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 |
if (a != XMLSchemaComponent.xmlns) and\ | if (a not in (XMLSchemaComponent.xmlns, XMLNS.XML)) and\ | def __checkAttributes(self): """Checks that required attributes have been defined, attributes w/default cannot be required. Checks all defined attributes are legal, attribute references are not subject to this test. """ for a in self.__class__.required: if not self.attributes.has_key(a): raise SchemaError,\ 'class in... |
class DefinitionMarker: """marker for definitions """ pass class DeclarationMarker: """marker for declarations """ pass class AttributeMarker: """marker for attributes """ pass class AttributeGroupMarker: """marker for attribute groups """ pass class WildCardMarker: """marker for wildcards """ pass class ElementMa... | def getImportSchemas(self): """returns WSDLTools.WSDL types Collection """ return self._parent().types | |
class Import(XMLSchemaComponent, MarkerInterface): | class Import(XMLSchemaComponent): | def load(self, 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.attri... |
class Include(XMLSchemaComponent, MarkerInterface): | class Include(XMLSchemaComponent): | 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: ns = self.attributes['namespace'] schema = self._parent().getImportSchemas().... |
MarkerInterface,\ | 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. """ if not self._schema: #schema = self._parent()._parent() schema = self._parent() #self._schema = schema.getIncludeSchemas(\ # ... | |
MarkerInterface,\ | def fromDom(self, node): """ No list or union support """ self.setAttributes(node) contents = self.getContents(node) | |
MarkerInterface,\ | def fromDom(self, node): self.setAttributes(node) contents = self.getContents(node) | |
MarkerInterface,\ | def fromDom(self, node): self.setAttributes(node) contents = self.getContents(node) content = [] | |
MarkerInterface,\ | def fromDom(self, node): self.setAttributes(node) contents = self.getContents(node) constraints = [] | |
MarkerInterface,\ | def fromDom(self, node): self.annotation = None self.setAttributes(node) for i in self.getContents(node): component = SplitQName(i.getTagName())[1] if component in self.__class__.contents['xsd']: if component == 'annotation' and not self.annotation: self.annotation = Annotation(self) self.annotation.fromDom(i) else: ra... | |
self.attr_content.append(AttributeGroupDefinition(self)) | if contents[indx].hasattr('ref'): self.attr_content.append(AttributeGroupReference(self)) else: self.attr_content.append(AttributeGroupDefinition(self)) | def fromDom(self, node): self.setAttributes(node) contents = self.getContents(node) |
class Extension(_DerivationBase, MarkerInterface, ExtensionMarker): | class Extension(_DerivationBase, ExtensionMarker): | def fromDom(self, node): self.setAttributes(node) contents = self.getContents(node) |
MarkerInterface,\ | def fromDom(self, node): self.setAttributes(node) contents = self.getContents(node) for child in contents: component = SplitQName(child.getTagName())[1] if component == 'annotation': self.annotation = Annotation(self) self.annotation.fromDom(child) continue break else: return if component == 'restriction': self.content... | |
MarkerInterface,\ | def fromDom(self, node): self.setAttributes(node) contents = self.getContents(node) self.content = [] self.attr_content = [] | |
print "XMLSchema(%s) ADD IMPORT SCHEMA: %s" \ %(self.targetNamespace, schema.targetNamespace) | def addImportSchema(self, schema): """for resolving import statements in Schema instance schema -- schema instance _imported_schemas """ print "XMLSchema(%s) ADD IMPORT SCHEMA: %s" \ %(self.targetNamespace, schema.targetNamespace) if not isinstance(schema, XMLSchema): raise TypeError, 'expecting a Schema instance' if ... | |
warnings.warn(\ '<import namespace="%s" schemaLocation=?>, %s'\ %(import_ns, 'failed to load schema instance') ) | def load(self, node, location=None): self.__node = node | |
def getAttribute(self, attribute): """return attribute. If attribute is type and it's None, and no simple or complex content, return the default type "xsd:anyType" """ value = XMLSchemaComponent.getAttribute(self, attribute) if attribute != 'type' or value is not None: return value if self.content is not None: return ... | def isQualified(self): """ | |
print 'called ', msg | def failureException(exc, msg): print 'called ', msg if msg.str.startswith('Connection timed out'): print msg sys.stdout.flush() return False else: return True """ else: raise """ | |
'%s%s = {}'%(ID3, self.attribute_typecode), | '%sif getattr(self, "attribute_typecode_dict", None) is None: %s = {}' %( ID3, self.attribute_typecode), | def _setContent(self): # TODO: Add derivation logic to constructors. if type(self.sKlass) in (types.ClassType, type): definition = [ '%sclass %s(%s, TypeDefinition):' \ % (ID1, self.getClassName(), self.sKlass), '%s# ComplexType/SimpleContent derivation of built-in type' %ID2, '%s%s' % (ID2, self.schemaTag()), '%s%s' %... |
'%sif not hasattr(self, %s): self.%s = {}'%( ID3, self.attribute_typecode, self.attribute_typecode), | '%sif getattr(self, "attribute_typecode_dict", None) is None: %s = {}' %( ID3, self.attribute_typecode), | def _setContent(self): # TODO: Add derivation logic to constructors. if type(self.sKlass) in (types.ClassType, type): definition = [ '%sclass %s(%s, TypeDefinition):' \ % (ID1, self.getClassName(), self.sKlass), '%s# ComplexType/SimpleContent derivation of built-in type' %ID2, '%s%s' % (ID2, self.schemaTag()), '%s%s' %... |
1e30000, 'b': 0.0}) | TC._make_inf(), 'b': 0.0}) | def checkt1(self): for key,val in self.badTests: print "\n", "." * 60, key self.failUnlessRaises(ParseException, ParsedSoap, val) for key,val in self.goodTests: print "\n", "." * 60, key ps = ParsedSoap(val) |
if hasattr(node, 'documentElement'): | if hasattr(self.__node, 'documentElement'): | def loadDocument(self, file): self.__node = DOM.loadDocument(file) if hasattr(node, 'documentElement'): self.__node = node.documentElement |
if hasattr(node, 'documentElement'): self.__node = node.documentElement | if hasattr(self.__node, 'documentElement'): self.__node = self.__node.documentElement | def loadFromURL(self, url): self.__node = DOM.loadFromURL(url) if hasattr(node, 'documentElement'): self.__node = node.documentElement |
tc.klass = 'self.__class__.%s%s' % (element_class_name(tc.name)) | tc.klass = 'self.__class__.%s' % (element_class_name(tc.name)) | 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... |
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%s' % (ID3, self.nsuriLogic()), '%sTClist = [%s]' % (ID3, self.getTypecodeList()), ] | 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%s' % (ID3, self.nsuriLogic()), '%sTClist = [%s]' % (ID3, self.getTypecodeList()), ] except Exception... | def _setContent(self): 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]' % (I... |
o += '\n%s a.getType().getName()) | if a.getType(): o += '\n%s a.getType().getName()) | o = '\n%sdef %s(self, ps):' % (ID1, self.getMethodName(op.getName())) |
o += "\n%s | if a.getType(): o += "\n%s a.getType().getName()) | o = '\n%sdef %s(self, %s):' % (ID1, op.getName(), iargs) |
o += "\n%s a.getName(), a.getType().getName()) | if a.getType(): o += "\n%s a.getType().getName()) | o = '\n%sdef %s(self, %s):' % (ID1, op.getName(), iargs) |
component = SplitQName(contents[indx].getTagName())[1] if component == 'annotation': self.annotation = Annotation(self) self.annotation.fromDom(contents[indx]) indx += 1 | if num: | def fromDom(self, node): self.setAttributes(node) contents = self.getContents(node) |
if component == 'annotation': self.annotation = Annotation(self) self.annotation.fromDom(contents[indx]) indx += 1 component = SplitQName(contents[indx].getTagName())[1] | def fromDom(self, node): self.setAttributes(node) contents = self.getContents(node) | |
return "<Fault %s: %s>" % (self.faultcode, self.faultstring) | if self.detail: return "<Fault %s: %s: %s>" % (self.faultcode, self.faultstring, self.detail) else: return "<Fault %s: %s>" % (self.faultcode, self.faultstring) | def __repr__(self): return "<Fault %s: %s>" % (self.faultcode, self.faultstring) |
if code == 500 and headers.get("content-type","text/xml") != "text/xml": | if code == 500 and not startswith(content_type, "text/xml"): | def call(self, addr, data, soapaction = '', encoding = None, http_proxy = None, config = Config): |
if t[0:3] == 'xsd': | if t[0:4] == 'xsd:': | def getArrayType(self): |
t = ns + sample._type | t = ns + str(sample._type) | 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 level > 10: | if level > 12: | def recurseTypeList(self, allTypeDict, typeList, level, alreadyListed): """Recurse through a dictionary of type lists until reach Python types. """ if level > 10: return strList = [] for item in typeList: if item[0].startswith('_'): indent = ID2 + IDSP2*level strList.append('%s%s: %s' % (indent, item[0], item[1])) if i... |
alreadyListed.append(item[1]) | def recurseTypeList(self, allTypeDict, typeList, level, alreadyListed): """Recurse through a dictionary of type lists until reach Python types. """ if level > 10: return strList = [] for item in typeList: if item[0].startswith('_'): indent = ID2 + IDSP2*level strList.append('%s%s: %s' % (indent, item[0], item[1])) if i... | |
if kw.has_key('typed'): | if pname is None and kw.has_key('typed'): | def __init__(self, pyclass, ofwhat, pname=None, inorder=0, inline=0, |
return self._getType(tp, elementName, literal, local, namespaceURI) | if not typeObj: typeObj = self._getType(tp, elementName, literal, local, namespaceURI) minOccurs = int(element.getAttribute('minOccurs')) typeObj.optional = not minOccurs maxOccurs = element.getAttribute('maxOccurs') if maxOccurs == 'unbounded': typeObj.repeatable = True return typeObj | 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... |
print h | def process_headers(self, headers, ps): | |
print sys.argv[0] + ': Usage error.' | print >>sys.stderr, sys.argv[0] + ': Usage error.' | def handle_error(self, req, client_address): |
pyobj = self.pyclass() | pyobj = self.pyclass(self.aname) | 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... |
if node._attrs.has_key(name): return 1 for item in node._attrsNS.keys(): if item[1] == name: return 1 return 0 return node._attrsNS.has_key((nsuri, name)) | if node.hasAttribute(name): return True return False return node.hasAttributeNS(nsuri, name) | def hasAttr(self, node, name, nsuri=None): """Return true if element has attribute with the given name and optional nsuri. If nsuri is not specified, returns true if an attribute exists with the given name with any namespace.""" if nsuri is None: if node._attrs.has_key(name): return 1 for item in node._attrsNS.keys(): ... |
raise WsdlGeneratorError,\ 'suspect circular import of %s - not suported' % ns | pass | def write_dependent_schema(self, schema, fd): """Write schema instance contents w/respect to dependency requirements. First write any schema that is imported directly into current schema, then check current schema's xmlns and see if any of these represent currently held schema instances. |
continue | raise WsdlGeneratorError, 'no soap address specified for port %s - not supported' % p.getName() | def fromWsdl(self, service, typeDict=None): """service -- wsdl.Service instance """ |
self.basector.set('\n\n%s%s.__init__(self,pname=name, **kw)' % (ID3,tpc)) | self.basector.set('\n\n%s%s.__init__(self,pname=name, aname="_%%s" %% name, **kw)' % (ID3,tpc)) | self.initdef.set('\n\n%sdef __init__(self, name=None, ns=None, **kw):' \ % ID2) |
raise WSDLError( 'The parts argument must be a sequence.' ) | parts = parts.split() | def __init__(self, use, namespace=None, encodingStyle=None, parts=None): if not use in ('literal', 'encoded'): raise WSDLError( 'Invalid use attribute value: %s' % use ) self.encodingStyle = encodingStyle self.namespace = namespace if type(parts) in (type(''), type(u'')): raise WSDLError( 'The parts argument must be a ... |
self.nspname, self.pname = None, pname | self.nspname, self.pname = pname | def __init__(self, pname=None, oname=None, aname=None, optional=0, |
tp.loadSchema(schema) | try: tp.loadSchema(schema) except SchemaError: warnings.warn(\ '<import namespace="%s" schemaLocation=?>, %s'\ %(import_ns, 'failed to load schema instance') ) del slocd[import_ns] continue | def load(self, node, location=None): self.__node = node |
def loadFromURL(self, url): | def loadFromURL(self, url, schema=None): | def loadFromURL(self, url): """Return an XMLSchema instance loaded from the given url. url -- URL to dereference """ reader = self.__readerClass() if self.__base_url: url = basejoin(self.__base_url,url) |
schema = XMLSchema() | schema = schema or XMLSchema() | def loadFromURL(self, url): """Return an XMLSchema instance loaded from the given url. url -- URL to dereference """ reader = self.__readerClass() if self.__base_url: url = basejoin(self.__base_url,url) |
print "Warning: Not keeping schema component." | warnings.warn("Not keeping schema component.") | def load(self, node, location=None): self.__node = node |
import_ns = tp.getAttribute('namespace') or \ self.__class__.empty_namespace if not self.getImportSchemas().has_key(import_ns) and \ tp.getAttribute('schemaLocation'): self.addImportSchema(tp.getSchema()) | import_ns = tp.getAttribute('namespace') or\ self.__class__.empty_namespace schema = slocd.get(import_ns) if schema is None: schema = XMLSchema() slocd[import_ns] = schema tp.loadSchema(schema) else: tp._schema = schema if self.getImportSchemas().has_key(import_ns): warnings.warn(\ 'Detected multiple imports of the na... | def load(self, node, location=None): self.__node = node |
pass | warnings.warn('redefine is ignored') | def load(self, node, location=None): self.__node = node |
pass | warnings.warn('annotation is ignored') | def load(self, node, location=None): self.__node = node |
def _is_derived_type(v, what): typecode = getattr(v, 'typecode', None) if typecode is not None and isinstance(typecode, what.__class__): return True return False def _get_what(v): typecode = getattr(v,'typecode', None) if isinstance(typecode, TypeCode): | def _get_type_or_substitute(typecode, pyobj, sw, elt): '''return typecode or substitute type (must be derived type). For serialization only. ''' sub = getattr(pyobj,'typecode', typecode) if sub is typecode: | def _is_derived_type(v, what): typecode = getattr(v, 'typecode', None) if typecode is not None and isinstance(typecode, what.__class__): return True return False |
raise EvaluateException, 'instance is not self-describing' | if isinstance(sub, ElementDeclaration): raise TypeError(\ 'failed to serialize (%s, %s) illegal sub GED (%s,%s): %s' % (typecode.nspname, typecode.pname, sub.nspname, sub.pname, sw.Backtrace(elt),)) if not isinstance(sub, typecode.__class__): raise TypeError(\ 'failed to serialize substitute %s for %s, not derivation... | def _get_what(v): typecode = getattr(v,'typecode', None) if isinstance(typecode, TypeCode): return typecode raise EvaluateException, 'instance is not self-describing' |
if _is_derived_type(v, whatTC) and v.typecode is not what: what = _get_what(v) if isinstance(what, ElementDeclaration): raise TypeError('At %s: failed to serialize (%s, %s) substitute type is a GED (%s,%s)' % (sw.Backtrace(elt), whatTC.nspname, whatTC.pname, what.nspname, what.pname,)) if debug: self.logger.debug('use... | def cb(self, elt, sw, pyobj, name=None, **kw): debug = self.logger.debugOn() if debug: self.logger.debug("cb: %s" %str(self.ofwhat)) if pyobj is None: if self.nillable is True: elem = elt.createAppendElement(self.nspname, self.pname) self.serialize_as_nil(elem) return raise EvaluateException, 'element(%s,%s) is not ni... | |
raise EvaluateException('occurances(%d) less than minOccurs(%d) for <%s>' %( occurs, whatTC.minOccurs, what.pname), sw.Backtrace(elt)) | raise EvaluateException(\ 'occurances(%d) less than minOccurs(%d) for <%s>' % (occurs, whatTC.minOccurs, what.pname), sw.Backtrace(elt)) | def cb(self, elt, sw, pyobj, name=None, **kw): debug = self.logger.debugOn() if debug: self.logger.debug("cb: %s" %str(self.ofwhat)) if pyobj is None: if self.nillable is True: elem = elt.createAppendElement(self.nspname, self.pname) self.serialize_as_nil(elem) return raise EvaluateException, 'element(%s,%s) is not ni... |
return re.sub('[-./:]', '_', tmp) | return re.sub('[-./:]', '_', s) | def textProtect(s): """process any strings we cant have illegal chracters in""" # Seems like maketrans/translate would be worthwhile here. return re.sub('[-./:]', '_', tmp) |
self.name = tp.getName() + '_Def' | def fromType(self, myType): """myType -- Type representation """ | |
self.name = tp.getName() + '_Dec' | def fromType(self, myType): """myType -- Type representation """ | |
self.precede = '%s' %(etp.getName()) | self.precede = '%s' %(etp.getName() + '_Def' ) | def _elementComplexType(self, tp, etp): |
dt.getDerivation()) | dt.getDerivation()\ + '_Def') | self.classdef = '\n\n%sclass %s(%s):' %(ID1, tp.getName() \ + '_Def', dt.getDerivation()) |
self.initdef += '\n%s%s.__init__(self, name=name, ns=ns, **kw)' % (ID4, dt.getDerivation()) self.initdef += '\n%sself.ofwhat += TCList' % ID4 | self.initdef += '\n%s%s.%s.__init__(self, name=name, ns=ns, **kw)' % (ID4, nsp, dt.getDerivation() + '_Def' ) self.initdef += '\n%sself.ofwhat += self.ofwhat + tuple(TCList)' % ID4 self.initdef += '\n%sself.lenofwhat += self.lenofwhat + len(TCList)' % ID4 | self.initdef += '\n%s%s.__init__(self, name=name, ns=ns, **kw)' % (ID4, dt.getDerivation()) |
if namespaceURI != self.reserved_ns[prefix]: | if namespaceURI == self.reserved_ns[prefix]: qualifiedName = '%s:%s' %(prefix,localName) elif namespaceURI is localName is None: self.node = self._dom.createDocument(None,None,None) return else: | def createDocument(self, namespaceURI, localName, doctype=None): prefix = self._soap_env_prefix if namespaceURI != self.reserved_ns[prefix]: raise KeyError, 'only support creation of document in %s' %self.reserved_ns[prefix] qualifiedName = '%s:%s' %(prefix,localName) |
qualifiedName = '%s:%s' %(prefix,localName) | def createDocument(self, namespaceURI, localName, doctype=None): prefix = self._soap_env_prefix if namespaceURI != self.reserved_ns[prefix]: raise KeyError, 'only support creation of document in %s' %self.reserved_ns[prefix] qualifiedName = '%s:%s' %(prefix,localName) | |
self._setAttributeNS(self._xsi_nsuri, '%s:type' %self._xsi_prefix, value) | xsi_prefix = self.getPrefix(self._xsi_nsuri) self._setAttributeNS(self._xsi_nsuri, '%s:type' %xsi_prefix, value) | def setAttributeType(self, namespaceURI, localName): '''set xsi:type Keyword arguments: namespaceURI -- namespace of attribute value localName -- name of new attribute value |
self.typecode += '\n%sdef __init__(self):' %(ID1) | self.typecode += '\n%sdef __init__(self, name=None, ns=None):' \ % (ID1) | self.typecode += '\n%sdef __init__(self):' %(ID1) |
l += tp.typecode | if tp.typecode[0][0:3] != 'ZSI': qualifiedtc = tp.typecode[0:] idx = qualifiedtc[0].find('(') qualifiedtc[0] = self.nsh.getAlias(tp.tns) + \ '.' + qualifiedtc[0][0:idx] + \ '_Def' + qualifiedtc[0][idx:] l += qualifiedtc else: l += tp.typecode | self.typecode += '\n%sdef __init__(self, name=None, ns=None): pass' %(ID1) break |
self.typecode += '\n%s%s.typecode = Struct(%s,[%s],pname="%s",aname="_%s",oname="%s xmlns=\\"%s\\"")'\ | if namespace == None: namespace = '' if style == 'rpc': namespace = '' 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,message.getName(),message.getName(), message.getName(),namespace) | tcs,namespace) | self.typecode += '\n%sdef __init__(self, name=None, ns=None): pass' %(ID1) break |
self.initdef.set('\n\n%sdef __init__(self, name=None, ns=None):' \ | self.initdef.set('\n\n%sdef __init__(self, name=None, ns=None, **kw):' \ | self.initdef.set('\n\n%sdef __init__(self, name=None, ns=None):' \ % ID2) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.