rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
self.basector.set('\n\n%s%s.__init__(self,pname=name)' % (ID3,tpc))
self.basector.set('\n\n%s%s.__init__(self,pname=name, **kw)' % (ID3,tpc))
self.initdef.set('\n\n%sdef __init__(self, name=None, ns=None):' \ % ID2)
self.initdef.set('\n\n%sdef __init__(self, name=None, ns=None):' %(ID2))
self.initdef.set('\n\n%sdef __init__(self, name=None, ns=None, **kw):' %(ID2))
self.initdef.set('\n\n%sdef __init__(self, name=None, ns=None):' %(ID2))
self.basector.set('\n\n%s%s.__init__(self)' % (ID3, typeName)) self.postpend.set('\n%sself.typecode = %s(name=name, ns=ns)' % (ID3, typeName))
self.basector.set('\n\n%s%s.__init__(self, name=name, ns=ns, **kw)' % (ID3, typeName)) self.postpend.set('\n%sself.typecode = %s(name=name, ns=ns, **kw)' % (ID3, typeName))
self.initdef.set('\n\n%sdef __init__(self, name=None, ns=None):' %(ID2))
else:
elif hasattr(file, 'name'):
def loadFromStream(self, file, name=None): """Return a WSDL instance loaded from a file object.""" document = DOM.loadDocument(file) wsdl = WSDL() if name: wsdl.location = name else: wsdl.location = file.name wsdl.load(document) return wsdl
data = _child_elements(self.ps.body_root)
elt_name = '%s' % self.ps.body_root.localName if elt_name.find('Response') > 0: data = _child_elements(self.ps.body_root) else: data = [self.ps.body_root]
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...
clazz = getattr(self.typesmodule, 'type')
clazz = getattr(self.typesmodule, type)
def __parse(self, node, type): try: if hasattr(self.typesmodule, type): clazz = getattr(self.typesmodule, 'type') tc = clazz.typecode return tc.parse(node, self.ps) else: tc = TC.Any(aslist=1) return tc.parse(node, self.ps) except Exception, e: tc = TC.Any(aslist=1) return tc.parse(node, self.ps)
sock, addr = get_request(self)
sock, addr = SocketServer.TCPServer.get_request(self)
def get_request(self): sock, addr = get_request(self)
class SOAPServer(SocketServer.TCPServer, SOAPServerBase):
class SOAPServer(SOAPServerBase, SocketServer.TCPServer):
def log_message(self, format, *args): if self.server.log: BaseHTTPServer.BaseHTTPRequestHandler.\ log_message (self, format, *args)
class ThreadingSOAPServer(SocketServer.ThreadingTCPServer, SOAPServerBase):
class ThreadingSOAPServer(SOAPServerBase, SocketServer.ThreadingTCPServer):
def __init__(self, addr = ('localhost', 8000), RequestHandler = SOAPRequestHandler, log = 1, encoding = 'UTF-8', config = Config, namespace = None, ssl_context = None):
class SOAPUnixSocketServer(SocketServer.UnixStreamServer, SOAPServerBase):
class SOAPUnixSocketServer(SOAPServerBase, SocketServer.UnixStreamServer):
def __init__(self, addr = ('localhost', 8000), RequestHandler = SOAPRequestHandler, log = 1, encoding = 'UTF-8', config = Config, namespace = None, ssl_context = None):
group.append( self.__adapterWrap( x ) )
t = self.__adapterWrap(x) t._dec.attributes['nillable'] = u"true" group.append( t )
def getModelGroup(self): """returns a model group adapter """
bti = self.__class__.bti tpc = bti.get_typeclass( self._def.content.\ attributes['itemType'][1], self._def.content.\ attributes['itemType'][0] )
if self._def.content.attributes.has_key('itemType'): bti = self.__class__.bti tpc = bti.get_typeclass( self._def.content.\ attributes['itemType'][1], self._def.content.\ attributes['itemType'][0] )
def getTypeclass(self): """get typeclass for simple type """
if t[0:4] == 'xsd:':
prefix, localName = SplitQName(t) namespaceURI = self._content.getXMLNS(prefix) if namespaceURI in SCHEMA.XSD_LIST:
def getArrayType(self):
tns = 'http://www.w3.org/2001/XMLSchema'
def getArrayType(self):
atype = bti.get_typeclass( t[4:-2], tns )
atype = bti.get_typeclass( localName[:-2], namespaceURI )
def getArrayType(self):
self.assertEquals( x._getAttr('nonamespaceURI') , '1') self.assertEquals( x._getAttr('NonenamespaceURI') , '2') self.assertEquals( x._getAttr(('http://some/namespace', 'namespaceURIattr1')) , '3') self.assertEquals( x._getAttr(('http://some/other/namespace', 'namespaceURIattr2')) , '4')
self.assertEquals( x._getAttr('nonamespaceURI') , 1) self.assertEquals( x._getAttr('NonenamespaceURI') , 2) self.assertEquals( x._getAttr(('http://some/namespace', 'namespaceURIattr1')) , 3) self.assertEquals( x._getAttr(('http://some/other/namespace', 'namespaceURIattr2')) , 4)
def testInstantiations(self): # string, ENTITY, ID, IDREF, language, Name, NCName, # NMTOKEN, QName, untypedType for t in (stringType, ENTITYType, IDType, IDREFType, languageType, NameType, NCNameType, NMTOKENType, QNameType, untypedType): # First some things that shouldn't be taken as the current type
wsdl = GWSDLReader().loadFromURL(path)
wsdl = WSDLReader().loadFromURL(path)
def setUpWsdl(path): """Load a WSDL given a file path or a URL. """ if path[:7] == 'http://': wsdl = GWSDLReader().loadFromURL(path) else: wsdl = GWSDLReader().loadFromFile(path) return wsdl
wsdl = GWSDLReader().loadFromFile(path)
wsdl = WSDLReader().loadFromFile(path)
def setUpWsdl(path): """Load a WSDL given a file path or a URL. """ if path[:7] == 'http://': wsdl = GWSDLReader().loadFromURL(path) else: wsdl = GWSDLReader().loadFromFile(path) return wsdl
component = SplitQName(i.getTagName())[1]
component = SplitQName(contents[indx].getTagName())[1]
def fromDom(self, node): self.setAttributes(node) contents = self.getContents(node) content = []
raise SchemaError, 'Unknown component (%s)' %(i.getTagName())
raise SchemaError, 'Unknown component (%s)' %(contents[indx].getTagName())
def fromDom(self, node): self.setAttributes(node) contents = self.getContents(node) content = []
'ref':None}
'ref':None, 'minOccurs':'1', 'maxOccurs':'1'}
def fromDom(self, node): self.setAttributes(node) contents = self.getContents(node)
raise SchemaError, 'Unknown component (%s)' %(contents[indx].getTagName())
raise SchemaError, 'Unknown component (%s)' %(component)
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) break else: return if component == 'restriction': self.content = self._...
if n == node.prefix or n in unsuppressedPrefixes: return 1
if (n=="" and node.prefix in [" n == node.prefix or n in unsuppressedPrefixes: return 1
def _utilized(n, node, other_attrs, unsuppressedPrefixes): '''_utilized(n, node, other_attrs, unsuppressedPrefixes) -> boolean Return true if that nodespace is utilized within the node''' if n.startswith('xmlns:'): n = n[6:] elif n.startswith('xmlns'): n = n[5:] if n == node.prefix or n in unsuppressedPrefixes: return...
_in_subset = lambda subset, node: not subset or node in subset
def _inclusiveNamespacePrefixes(node, context, unsuppressedPrefixes): '''http://www.w3.org/TR/xml-exc-c14n/ InclusiveNamespaces PrefixList parameter, which lists namespace prefixes that are handled in the manner described by the Canonical XML Recommendation''' inclusive = [] if node.prefix: usedPrefixes = ['xmlns:%s' %...
def _utilized(n, node, other_attrs, unsuppressedPrefixes): '''_utilized(n, node, other_attrs, unsuppressedPrefixes) -> boolean Return true if that nodespace is utilized within the node''' if n.startswith('xmlns:'): n = n[6:] elif n.startswith('xmlns'): n = n[5:] if n == node.prefix or n in unsuppressedPrefixes: return...
if self.subset: self.comments = kw.get('comments', 1) else: self.comments = kw.get('comments', 0)
self.comments = kw.get('comments', 0)
def __init__(self, node, write, **kw): '''Create and run the implementation.'''
self.state = (nsdict, ['xml'], [])
self.state = (nsdict, {'xml':''}, {})
def __init__(self, node, write, **kw): '''Create and run the implementation.'''
if self.unsuppressedPrefixes is not None: self._do_element(node)
if not _inclusive(self): inherited = _inclusiveNamespacePrefixes(node, self._inherit_context(node), self.unsuppressedPrefixes) self._do_element(node, inherited)
def __init__(self, node, write, **kw): '''Create and run the implementation.'''
s = node.data \ .replace("&", "&amp;") \ .replace("<", "&lt;") \ .replace(">", "&gt;") \ .replace("\015", "&
s = string.replace(node.data, "&", "&amp;") s = string.replace(s, "<", "&lt;") s = string.replace(s, ">", "&gt;") s = string.replace(s, "\015", "&
def _do_text(self, node): '''_do_text(self, node) -> None Process a text or CDATA node. Render various special characters as their C14N entity representations.''' if not _in_subset(self.subset, node): return s = node.data \ .replace("&", "&amp;") \ .replace("<", "&lt;") \ .replace(">", "&gt;") \ .replace("\015", "&#xD...
s = value \ .replace("&", "&amp;") \ .replace("<", "&lt;") \ .replace('"', '&quot;') \ .replace('\011', '& .replace('\012', '& .replace('\015', '&
s = string.replace(value, "&", "&amp;") s = string.replace(s, "<", "&lt;") s = string.replace(s, '"', '&quot;') s = string.replace(s, '\011', '& s = string.replace(s, '\012', '& s = string.replace(s, '\015', '&
def _do_attr(self, n, value): ''''_do_attr(self, node) -> None Process an attribute.'''
self.state[0], self.state[1][:], self.state[2][:]
self.state[0], self.state[1].copy(), self.state[2].copy()
def _do_element(self, node, initial_other_attrs = []): '''_do_element(self, node, initial_other_attrs = []) -> None Process an element (and its children).'''
other_attrs = initial_other_attrs[:]
other_attrs = []
def _do_element(self, node, initial_other_attrs = []): '''_do_element(self, node, initial_other_attrs = []) -> None Process an element (and its children).'''
for a in _attrs(node):
for a in _attrs(node) + initial_other_attrs:
def _do_element(self, node, initial_other_attrs = []): '''_do_element(self, node, initial_other_attrs = []) -> None Process an element (and its children).'''
if self.unsuppressedPrefixes is None or in_subset: xml_attrs.append(a)
if _inclusive(self) or (in_subset and _in_subset(self.subset, a)): xml_attrs_local[a.nodeName] = a
def _do_element(self, node, initial_other_attrs = []): '''_do_element(self, node, initial_other_attrs = []) -> None Process an element (and its children).'''
other_attrs.append(a)
if _in_subset(self.subset, a): other_attrs.append(a) xml_attrs.update(xml_attrs_local)
def _do_element(self, node, initial_other_attrs = []): '''_do_element(self, node, initial_other_attrs = []) -> None Process an element (and its children).'''
pval = ns_parent.get(n) if n == "xmlns" \ and v in [ XMLNS.BASE, '' ] and pval in [ XMLNS.BASE, '' ]:
if n == "xmlns" and v in [ XMLNS.BASE, '' ] \ and ns_rendered.get('xmlns') in [ XMLNS.BASE, '', None ]:
def _do_element(self, node, initial_other_attrs = []): '''_do_element(self, node, initial_other_attrs = []) -> None Process an element (and its children).'''
if n == "xmlns:xml" \
if n in ["xmlns:xml", "xml"] \
def _do_element(self, node, initial_other_attrs = []): '''_do_element(self, node, initial_other_attrs = []) -> None Process an element (and its children).'''
if (v != pval or n not in ns_rendered) \ and (self.unsuppressedPrefixes is None or \
if (n,v) not in ns_rendered.items() \ and (_inclusive(self) or \
def _do_element(self, node, initial_other_attrs = []): '''_do_element(self, node, initial_other_attrs = []) -> None Process an element (and its children).'''
ns_rendered.append(n) other_attrs.extend(xml_attrs) xml_attrs = []
ns_rendered[n]=v if not _inclusive(self) or _in_subset(self.subset,node.parentNode): other_attrs.extend(xml_attrs_local.values()) else: other_attrs.extend(xml_attrs.values())
def _do_element(self, node, initial_other_attrs = []): '''_do_element(self, node, initial_other_attrs = []) -> None Process an element (and its children).'''
self.cb(elt, sw, pyobj, **kw)
self.cb(elt, sw, pyobj, name=name, **kw)
def serialize(self, elt, sw, pyobj, inline=False, name=None, **kw): if inline or self.inline: self.cb(elt, sw, pyobj, **kw) else: objid = _get_idstr(pyobj) n = name or self.pname or ('E' + objid) el = elt.createAppendElement(None, n) el.setAttributeNS(None, 'href', "#%s" %objid) sw.AddCallback(self.cb, elt, sw, pyobj)
if unique is False and sw.Known(orig or pyobj):
if unique is False and sw.Known(pyobj):
def serialize(self, elt, sw, pyobj, name=None, childnames=None, **kw): debug = self.logger.debugOn() if debug: self.logger.debug("serialize: %r" %pyobj) if self.mutable is False and sw.Known(pyobj): return objid = _get_idstr(pyobj) n = name or self.pname or ('E' + objid) el = elt.createAppendElement(self.nspname, n)
self.set_attribute_id(el, _get_idstr(pyobj))
self.set_attribute_id(el, objid)
def serialize(self, elt, sw, pyobj, name=None, childnames=None, **kw): debug = self.logger.debugOn() if debug: self.logger.debug("serialize: %r" %pyobj) if self.mutable is False and sw.Known(pyobj): return objid = _get_idstr(pyobj) n = name or self.pname or ('E' + objid) el = elt.createAppendElement(self.nspname, n)
self.facets = []
def __init__(self, parent): XMLSchemaComponent.__init__(self, parent) self.annotation = None self.content = None self.facets = [] self.attr_content = None
facets = {}
def fromDom(self, node): self.setAttributes(node) contents = self.getContents(node) facets = {} indx = 0 num = len(contents) if not num: return
facets[component] = contents[indx] self.facets.append(facets)
self.facets.append(contents[indx])
def fromDom(self, node): self.setAttributes(node) contents = self.getContents(node) content = []
print pyobj == pyobj2, pyobj, pyobj2
self.failUnlessEqual(pyobj["i"], pyobj2.i) self.failUnlessEqual(pyobj["t"], pyobj2.t)
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)
print 'non-sparse', nsa
self.failUnlessEqual(nsa, [None, None, None, 12, 13, 14, 15, 16, 17])
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)
print 'sparse', sa
self.failUnlessEqual(sa, [(3, 12), (4, 13), (5, 14), (6, 15), (7, 16), (8, 17)])
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)
print '=' * 60 for i in [ 0, 12, 4 ] : b = mychoice.parse(elts[i], ps) print 'b=', type(b), b print '=' * 60 print TC.Array('x', TC.Any()).parse(elts[15], ps) print TC.Struct(None, (TC.FPfloat('a'), TC.Decimal('b'), TC.FPdouble('c'))).parse(elts[13],ps)
b = mychoice.parse(elts[0], ps) self.failUnlessEqual(b[0], 'Price') self.failUnlessEqual(b[1], 34) b = mychoice.parse(elts[12], ps) self.failUnlessEqual(b[0], 'uri') self.failUnlessEqual(b[1], u'"http://foo.com/~salz"') b = mychoice.parse(elts[4], ps) self.failUnlessEqual(b[0], 'n3') self.failUnlessEqual(b[1], u'The va...
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)
z = SoapWriter(sys.stdout, header=ps.header_elements, nsdict=nsdict)
sio = StringIO.StringIO() z = SoapWriter(sio, header=ps.header_elements, nsdict=nsdict)
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)
print '<!-- s2 -->'
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)
print '|'+elts[11].getAttributeNS('foo','bar')+'|' print 'Any=', TC.Any().parse(elts[11], ps)
self.failUnlessEqual(TC.Any().parse(elts[11], ps), {'urt-i': 12, 'urt-t': u'rich salz'})
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 self.isSimpleElementDeclaration(op):
simpleType = self.isSimpleElementDeclaration(op) if simpleType:
'\n%sdef %s(self, request):' % \
'\n%sif not type(request) == %s:' %( ID2, self.isSimpleElementDeclaration(op) )
'\n%sif not type(request) == %s:' %( ID2, simpleType)
'\n%sdef %s(self, request):' % \
myBinding['defs'][op.getName()] += '\n%s"""\n' % ID2 myBinding['defs'][op.getName()] += self.messages[inputName].\ docString(typeDict, inputName, True) myBinding['defs'][op.getName()] += '\n' if outputName: myBinding['defs'][op.getName()] += self.messages[outputName].\ docString(typeDict, outputName, False) myBinding['...
'\n%sdef %s(self, request):' % \
if isInput: docList.append('%s@param: request to %s' % (ID2, messageName)) else: docList.append('%s@return: response from %s' % (ID2, messageName))
def docString(self, allTypeDict, messageName, isInput): """Generates a docstring giving the input and output message names, and their associated parameters and parameter sub-fields. """ docList = [] if isInput: docList.append('%s@param: request to %s' % (ID2, messageName)) else: docList.append('%s@return: response from...
docList.append('::') docList.append('\n')
def docString(self, allTypeDict, messageName, isInput): """Generates a docstring giving the input and output message names, and their associated parameters and parameter sub-fields. """ docList = [] if isInput: docList.append('%s@param: request to %s' % (ID2, messageName)) else: docList.append('%s@return: response from...
docList.extend(self.recurseTypeList(allTypeDict, self.typeList, 1, alreadyListed))
paramList = self.recurseTypeList(allTypeDict, self.typeList, 1, alreadyListed) if paramList: if paramList[0].startswith('*Simple*'): startIndex = len('*Simple*') + 1 if isInput: docList.append('%s@param: request is %s\n' % (ID2, paramList[0][startIndex:])) else: docList.append('%s@return: response is %s\n' % (ID2, para...
def docString(self, allTypeDict, messageName, isInput): """Generates a docstring giving the input and output message names, and their associated parameters and parameter sub-fields. """ docList = [] if isInput: docList.append('%s@param: request to %s' % (ID2, messageName)) else: docList.append('%s@return: response from...
indent = ID2 + IDSP2*level strList.append('%s%s: %s' % (indent, item[0], item[1])) if item[2]: strList.append(', optional') strList.append('\n')
if not item[0].startswith('__param'): indent = ID2 + IDSP2*level strList.append('%s%s: %s' % (indent, item[0], item[1])) if item[2]: strList.append(', optional') strList.append('\n') else: return ['*Simple* %s' % item[1]]
def recurseTypeList(self, allTypeDict, typeList, level, alreadyListed): """Recurse through a dictionary of type lists until reach Python types. """ if level > 12: # just in case return strList = [] for item in typeList: if item[0].startswith('_'): indent = ID2 + IDSP2*level strList.append('%s%s: %s' % (indent, item[0]...
self.basector.set('\n\n%s%s.%s.__init__(self)' \ %(ID3, self.nsh.getAlias(nsp), etp.getName() + '_Def')) self.postpend.set('\n%sself.typecode = %s.%s(name=name, ns=ns)' % (ID3, self.nsh.getAlias(nsp), etp.getName() + '_Def'))
typeName = '%s.%s_Def' % (self.nsh.getAlias(nsp), etp.getName()) self.basector.set('\n\n%s%s.__init__(self)' % (ID3, typeName)) self.postpend.set('\n%sself.typecode = %s(name=name, ns=ns)' % (ID3, typeName)) self.typeDoc('', '_' + tp.getName(), typeName)
self.initdef.set('\n\n%sdef __init__(self, name=None, ns=None):' %(ID2))
def __init__(self, targetNamespace=None):
def __init__(self, targetNamespace=None, strict=1):
def __init__(self, targetNamespace=None): self.targetNamespace = targetNamespace or 'urn:this-document.wsdl' self.documentation = '' self.location = None self.document = None self.name = None self.services = Collection(self) self.messages = Collection(self) self.portTypes = Collection(self) self.bindings = Collection(s...
self.imports = Collection(self, key=f)
self.imports = Collection(self, key=ns)
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...
if component == 'complexType':
if component == 'attribute': tp = AttributeDeclaration(self) tp.fromDom(node) self.types[tp.getAttribute('name')] = tp elif component == 'attributeGroup': tp = AttributeGroupDefinition(self) tp.fromDom(node) self.types[tp.getAttribute('name')] = tp elif component == 'complexType':
def load(self, node): self.setAttributes(node) self.targetNamespace = self.getTargetNamespace() contents = self.getContents(node)
elif component == 'group': tp = ModelGroupDefinition(self) tp.fromDom(node) self.modelGroups[tp.getAttribute('name')] = tp elif component == 'notation': tp = Notation(self) tp.fromDom(node) self.notations[tp.getAttribute('name')] = tp
def load(self, node): self.setAttributes(node) self.targetNamespace = self.getTargetNamespace() contents = self.getContents(node)
self.content = SimpleType(self)
self.content = AnonymousSimpleType(self)
def fromDom(self, node): """ No list or union support """ self.setAttributes(node) contents = self.getContents(node)
self.content = SimpleType(self)
self.content = AnonymousSimpleType(self)
def fromDom(self, node): self.setAttributes(node) contents = self.getContents(node)
annotation?
annotation?, (attribute | attributeGroup)*, anyAttribute?
def fromDom(self, node): self.setAttributes(node) contents = self.getContents(node)
for i in contents:
content = [] for indx in range(len(contents)):
def fromDom(self, node): self.setAttributes(node) contents = self.getContents(node)
if component == 'annotation' and not self.annotation:
if (component == 'annotation') and (not indx):
def fromDom(self, node): self.setAttributes(node) contents = self.getContents(node)
self.annotation.fromDom(i)
self.annotation.fromDom(contents[indx]) elif (component == 'attribute'): if contents[indx].hasattr('name'): content.append(AttributeDeclaration()) elif contents[indx].hasattr('ref'): content.append(AttributeReference()) else: raise SchemaError, 'Unknown attribute type' content[-1].fromDom(contents[indx]) elif (componen...
def fromDom(self, node): self.setAttributes(node) contents = self.getContents(node)
def fromDom(node):
def fromDom(self, node):
def fromDom(node): self.setAttributes(node) contents = self.getContents(node) fields = []
def fromDom(node):
def fromDom(self, node):
def fromDom(node): self.setAttributes(node) contents = self.getContents(node)
self.attr_content.append(AttributeGroupDefinition(self))
self.attr_content.append(AttributeGroupReference(self))
def fromDom(self, node): self.setAttributes(node) contents = self.getContents(node) indx = 0 num = len(contents) #XXX ugly if not num: return component = SplitQName(contents[indx].getTagName())[1] if component == 'annotation': self.annotation = Annotation(self) self.annotation.fromDom(contents[indx]) indx += 1 compone...
annotation?, (group | all | choice | sequence)?, (attribute | attributeGroup)*, anyAttribute?
annotation?, (attribute | attributeGroup)*, anyAttribute?
def fromDom(self, node): self.setAttributes(node) contents = self.getContents(node)
contents = {'xsd':['annotation', 'group', 'all', 'choice',\ 'sequence', 'attribute', 'attributeGroup', 'anyAttribute']}
contents = {'xsd':['annotation', 'attribute', 'attributeGroup', 'anyAttribute']} def __init__(self, parent): XMLSchemaComponent.__init__(self, parent) self.annotation = None self.attr_content = None
def fromDom(self, node): self.setAttributes(node) contents = self.getContents(node)
if component == 'all': self.content = All(self) elif component == 'choice': self.content = Choice(self) elif component == 'sequence': self.content = Sequence(self) elif component == 'group': self.content = ModelGroupReference(self) else: raise SchemaError, 'Unknown component (%s)' %(contents[indx].getTagName()) self.c...
content = []
def fromDom(self, node): self.setAttributes(node) contents = self.getContents(node)
self.attr_content.append(AttributeReference(self))
content.append(AttributeReference(self))
def fromDom(self, node): self.setAttributes(node) contents = self.getContents(node)
self.attr_content.append(LocalAttributeDeclaration(self))
content.append(LocalAttributeDeclaration(self))
def fromDom(self, node): self.setAttributes(node) contents = self.getContents(node)
self.attr_content.append(AttributeGroupDefinition(self))
content.append(AttributeGroupReference(self))
def fromDom(self, node): self.setAttributes(node) contents = self.getContents(node)
self.attr_content.append(AttributeWildCard(self))
content.append(AttributeWildCard(self))
def fromDom(self, node): self.setAttributes(node) contents = self.getContents(node)
raise SchemaError, 'Unknown component (%s)' %(contents[indx].getTagName()) self.attr_content[-1].fromDom(contents[indx])
raise SchemaError, 'Unknown component (%s)'\ %(contents[indx].getTagName()) content[-1].fromDom(contents[indx])
def fromDom(self, node): self.setAttributes(node) contents = self.getContents(node)
self.content = []
content = []
def fromDom(self, node): self.setAttributes(node) contents = self.getContents(node) self.content = [] self.attr_content = []
self.content.append(SimpleType(self)) self.content[-1].fromDom(contents[indx])
content.append(AnonymousSimpleType(self)) content[-1].fromDom(contents[indx])
def fromDom(self, node): self.setAttributes(node) contents = self.getContents(node) self.content = [] self.attr_content = []
"""<union>
"""<list>
def fromDom(self, node): self.setAttributes(node) contents = self.getContents(node) self.content = [] self.attr_content = []
'memberTypes':None }
'itemType':None }
def fromDom(self, node): self.setAttributes(node) contents = self.getContents(node) self.content = [] self.attr_content = []
typecodelist += self._ComplexTypeChoice(tp, mg)
typecodelist += self._complexTypeChoice(tp, mg)
self.initdef += '\n%sdef __init__(self, name=None, ns=None, **kw):' % (ID2)
for e in mg.getContents():
for e in mg.getContent():
def _complexTypeChoice( self, tp, mg ):
return typecode
return typecodelist
self.initdef += '\n%sself._%s = None' % (ID2, e.getName())
if hasattr(p, 'type'):
if p.getType():
self.typecode += '\n%sdef __init__(self, name=None, ns=None): pass' %(ID1) break
if hp and hp.find(':'): self.port = int(hp.split(':', 2)[1])
if hp and hp[1].find(':') != -1: self.port = int(hp[1].split(':', 2)[1])
def __init__(self, nsdict=None, ssl=0, url=None, tracefile=None,
self.header = None
def build(self): if Config.debug: print "In build." ns_map = {}
if isinstance(v, what.__class__):
typecode = getattr(v, 'typecode', None) if typecode is not None and isinstance(typecode, what.__class__):
def _is_derived_type(v, what): if isinstance(v, what.__class__): return True return False
if isinstance(v,TypeCode) is True: return v elif hasattr(v,'typecode') and isinstance(v,TypeCode):
typecode = getattr(v,'typecode', None) if isinstance(typecode, TypeCode):
def _get_what(v): if isinstance(v,TypeCode) is True: return v elif hasattr(v,'typecode') and isinstance(v,TypeCode): return typecode raise EvaluateException, 'instance is not self-describing'
def _set_element_from_type(v, what): if _is_derived_type(v,what): v.nspname = what.nspname v.pname = what.pname v.aname = what.aname v.minOccurs = what.minOccurs v.maxOccurs = what.maxOccurs else: raise EvaluateException, ''
def _get_what(v): if isinstance(v,TypeCode) is True: return v elif hasattr(v,'typecode') and isinstance(v,TypeCode): return typecode raise EvaluateException, 'instance is not self-describing'
_set_element_from_type(what, whatTC)
if debug: self.logger.debug('use derived(%s) from %s' %(what.__class__, whatTC.__class__)) what.nspname = whatTC.nspname what.pname = whatTC.pname what.aname = whatTC.aname what.minOccurs = whatTC.minOccurs what.maxOccurs = whatTC.maxOccurs
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...
def __init__(self, parent, key=Collection.default):
def __init__(self, parent, key=None):
def __init__(self, parent, key=Collection.default): UserDict.__init__(self) self.parent = weakref.ref(parent) self.list = [] self._func = key
self._func = key
self._func = key or self.default
def __init__(self, parent, key=Collection.default): UserDict.__init__(self) self.parent = weakref.ref(parent) self.list = [] self._func = key
self._attrs[attr] = unicode(value)
if type(value) is StringType: value = unicode(value) self._attrs[attr] = value
def _setAttr(self, attr, value): attr = self._fixAttr(attr)
if tag=='': tag = self.gentag()
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
tag = tag or self.gentag()
def dump_list(self, obj, tag, typed = 1, ns_map = {}): if Config.debug: print "In dump_list.", "obj=", obj if type(obj) == InstanceType: data = obj.data else: data = obj
if prefix: return "%s:%s" % (prefix, u''.join(X))
def toXMLname(string): """Convert string to a XML name.""" if string.find(':') != -1 : (prefix, localname) = string.split(':',1) else: prefix = None localname = string T = unicode(localname) N = len(localname) X = []; for i in range(N) : if i< N-1 and T[i]==u'_' and T[i+1]==u'x': X.append(u'_x005F_') elif i==0 and N ...