desc stringlengths 3 26.7k | decl stringlengths 11 7.89k | bodies stringlengths 8 553k |
|---|---|---|
'Request succeeded, process the reply
@param binding: The binding to be used to process the reply.
@type binding: L{bindings.binding.Binding}
@param reply: The raw reply text.
@type reply: str
@return: The method result.
@rtype: I{builtin}, L{Object}
@raise WebFault: On server.'
| def succeeded(self, binding, reply):
| log.debug('http succeeded:\n%s', reply)
plugins = PluginContainer(self.options.plugins)
if (len(reply) > 0):
(reply, result) = binding.get_reply(self.method, reply)
self.last_received(reply)
else:
result = None
ctx = plugins.message.unmarshalled(reply=result)
result = ... |
'Request failed, process reply based on reason
@param binding: The binding to be used to process the reply.
@type binding: L{suds.bindings.binding.Binding}
@param error: The http error message
@type error: L{transport.TransportError}'
| def failed(self, binding, error):
| (status, reason) = (error.httpcode, tostr(error))
reply = error.fp.read()
log.debug('http failed:\n%s', reply)
if (status == 500):
if (len(reply) > 0):
(r, p) = binding.get_fault(reply)
self.last_received(r)
return (status, p)
else:
retu... |
'get whether loopback has been specified in the I{kwargs}.'
| @classmethod
def simulation(cls, kwargs):
| return kwargs.has_key(SimClient.injkey)
|
'Send the required soap message to invoke the specified method
@param args: A list of args for the method invoked.
@type args: list
@param kwargs: Named (keyword) args for the method invoked.
@type kwargs: dict
@return: The result of the method invocation.
@rtype: I{builtin} or I{subclass of} L{Object}'
| def invoke(self, args, kwargs):
| simulation = kwargs[self.injkey]
msg = simulation.get('msg')
reply = simulation.get('reply')
fault = simulation.get('fault')
if (msg is None):
if (reply is not None):
return self.__reply(reply, args, kwargs)
if (fault is not None):
return self.__fault(fault)
... |
'simulate the reply'
| def __reply(self, reply, args, kwargs):
| binding = self.method.binding.input
msg = binding.get_message(self.method, args, kwargs)
log.debug('inject (simulated) send message:\n%s', msg)
binding = self.method.binding.output
return self.succeeded(binding, reply)
|
'simulate the (fault) reply'
| def __fault(self, reply):
| binding = self.method.binding.output
if self.options.faults:
(r, p) = binding.get_fault(reply)
self.last_received(r)
return (500, p)
else:
return (500, None)
|
''
| def __init__(self):
| self.appender = ContentAppender(self)
|
'Process (marshal) the tag with the specified value using the
optional type information.
@param content: The content to process.
@type content: L{Object}'
| def process(self, content):
| log.debug('processing:\n%s', content)
self.reset()
if (content.tag is None):
content.tag = content.value.__class__.__name__
document = Document()
if isinstance(content.value, Property):
root = self.node(content)
self.append(document, content)
else:
self.append(doc... |
'Append the specified L{content} to the I{parent}.
@param parent: The parent node to append to.
@type parent: L{Element}
@param content: The content to append.
@type content: L{Object}'
| def append(self, parent, content):
| log.debug('appending parent:\n%s\ncontent:\n%s', parent, content)
if self.start(content):
self.appender.append(parent, content)
self.end(parent, content)
|
'Reset the marshaller.'
| def reset(self):
| pass
|
'Create and return an XML node.
@param content: The content for which proccessing has been suspended.
@type content: L{Object}
@return: An element.
@rtype: L{Element}'
| def node(self, content):
| return Element(content.tag)
|
'Appending this content has started.
@param content: The content for which proccessing has started.
@type content: L{Content}
@return: True to continue appending
@rtype: boolean'
| def start(self, content):
| return True
|
'Appending this content has suspended.
@param content: The content for which proccessing has been suspended.
@type content: L{Content}'
| def suspend(self, content):
| pass
|
'Appending this content has resumed.
@param content: The content for which proccessing has been resumed.
@type content: L{Content}'
| def resume(self, content):
| pass
|
'Appending this content has ended.
@param parent: The parent node ending.
@type parent: L{Element}
@param content: The content for which proccessing has ended.
@type content: L{Content}'
| def end(self, parent, content):
| pass
|
'Set the value of the I{node} to nill.
@param node: A I{nil} node.
@type node: L{Element}
@param content: The content to set nil.
@type content: L{Content}'
| def setnil(self, node, content):
| pass
|
'Set the value of the I{node} to a default value.
@param node: A I{nil} node.
@type node: L{Element}
@param content: The content to set the default value.
@type content: L{Content}
@return: The default.'
| def setdefault(self, node, content):
| pass
|
'Get whether the specified content is optional.
@param content: The content which to check.
@type content: L{Content}'
| def optional(self, content):
| return False
|
'@param tag: The content tag.
@type tag: str
@param value: The content\'s value.
@type value: I{any}'
| def __init__(self, tag=None, value=None, **kwargs):
| Object.__init__(self)
self.tag = tag
self.value = value
for (k, v) in kwargs.items():
setattr(self, k, v)
|
'@param schema: A schema object
@type schema: L{xsd.schema.Schema}
@param xstq: The B{x}ml B{s}chema B{t}ype B{q}ualified flag indicates
that the I{xsi:type} attribute values should be qualified by namespace.
@type xstq: bool'
| def __init__(self, schema, xstq=True):
| Core.__init__(self)
self.schema = schema
self.xstq = xstq
self.resolver = GraphResolver(self.schema)
|
'Get whether to skip this I{content}.
Should be skipped when the content is optional
and either the value=None or the value is an empty list.
@param content: The content to skip.
@type content: L{Object}
@return: True if content is to be skipped.
@rtype: bool'
| def skip(self, content):
| if self.optional(content):
v = content.value
if (v is None):
return True
if (isinstance(v, (list, tuple)) and (len(v) == 0)):
return True
return False
|
'Translate using the XSD type information.
Python I{dict} is translated to a suds object. Most
importantly, primative values are translated from python
types to XML types using the XSD type.
@param content: The content to translate.
@type content: L{Object}
@return: self
@rtype: L{Typed}'
| def translate(self, content):
| v = content.value
if (v is None):
return
if isinstance(v, dict):
cls = content.real.name
content.value = Factory.object(cls, v)
md = content.value.__metadata__
md.sxtype = content.type
return
v = content.real.translate(v, False)
content.value = v
r... |
'Sort suds object attributes based on ordering defined
in the XSD type information.
@param content: The content to sort.
@type content: L{Object}
@return: self
@rtype: L{Typed}'
| def sort(self, content):
| v = content.value
if isinstance(v, Object):
md = v.__metadata__
md.ordering = self.ordering(content.real)
return self
|
'Get the attribute ordering defined in the specified
XSD type information.
@param type: An XSD type object.
@type type: SchemaObject
@return: An ordered list of attribute names.
@rtype: list'
| def ordering(self, type):
| result = []
for (child, ancestry) in type.resolve():
name = child.name
if (child.name is None):
continue
if child.isattr():
name = ('_%s' % child.name)
result.append(name)
return result
|
'Cast the I{untyped} list items found in content I{value}.
Each items contained in the list is checked for XSD type information.
Items (values) that are I{untyped}, are replaced with suds objects and
type I{metadata} is added.
@param content: The content holding the collection.
@type content: L{Content}
@return: self
@... | def cast(self, content):
| aty = content.aty[1]
resolved = content.type.resolve()
array = Factory.object(resolved.name)
array.item = []
query = TypeQuery(aty)
ref = query.execute(self.schema)
if (ref is None):
raise TypeNotFound(qref)
for x in content.value:
if isinstance(x, (list, tuple)):
... |
'@param cls: A class object.
@type cls: I{classobj}'
| def __init__(self, cls):
| self.cls = cls
|
'@param marshaller: A marshaller.
@type marshaller: L{suds.mx.core.Core}'
| def __init__(self, marshaller):
| self.default = PrimativeAppender(marshaller)
self.appenders = ((Matcher(None), NoneAppender(marshaller)), (Matcher(null), NoneAppender(marshaller)), (Matcher(Property), PropertyAppender(marshaller)), (Matcher(Object), ObjectAppender(marshaller)), (Matcher(Element), ElementAppender(marshaller)), (Matcher(Text), ... |
'Select an appender and append the content to parent.
@param parent: A parent node.
@type parent: L{Element}
@param content: The content to append.
@type content: L{Content}'
| def append(self, parent, content):
| appender = self.default
for a in self.appenders:
if (a[0] == content.value):
appender = a[1]
break
appender.append(parent, content)
|
'@param marshaller: A marshaller.
@type marshaller: L{suds.mx.core.Core}'
| def __init__(self, marshaller):
| self.marshaller = marshaller
|
'Create and return an XML node that is qualified
using the I{type}. Also, make sure all referenced namespace
prefixes are declared.
@param content: The content for which proccessing has ended.
@type content: L{Object}
@return: A new node.
@rtype: L{Element}'
| def node(self, content):
| return self.marshaller.node(content)
|
'Set the value of the I{node} to nill.
@param node: A I{nil} node.
@type node: L{Element}
@param content: The content for which proccessing has ended.
@type content: L{Object}'
| def setnil(self, node, content):
| self.marshaller.setnil(node, content)
|
'Set the value of the I{node} to a default value.
@param node: A I{nil} node.
@type node: L{Element}
@param content: The content for which proccessing has ended.
@type content: L{Object}
@return: The default.'
| def setdefault(self, node, content):
| return self.marshaller.setdefault(node, content)
|
'Get whether the specified content is optional.
@param content: The content which to check.
@type content: L{Content}'
| def optional(self, content):
| return self.marshaller.optional(content)
|
'Notify I{marshaller} that appending this content has suspended.
@param content: The content for which proccessing has been suspended.
@type content: L{Object}'
| def suspend(self, content):
| self.marshaller.suspend(content)
|
'Notify I{marshaller} that appending this content has resumed.
@param content: The content for which proccessing has been resumed.
@type content: L{Object}'
| def resume(self, content):
| self.marshaller.resume(content)
|
'Append the specified L{content} to the I{parent}.
@param content: The content to append.
@type content: L{Object}'
| def append(self, parent, content):
| self.marshaller.append(parent, content)
|
'Automatically set the node\'s xsi:type attribute based on either I{value}\'s
class or the class of the node\'s text. When I{value} is an unmapped class,
the default type (xs:any) is set.
@param node: An XML node
@type node: L{sax.element.Element}
@param value: An object that is or would be the node\'s text.
@type val... | @classmethod
def auto(cls, node, value=None):
| if (value is None):
value = node.getText()
if isinstance(value, Object):
known = cls.known(value)
if (known.name is None):
return node
tm = (known.name, known.namespace())
else:
tm = cls.types.get(value.__class__, cls.types.get(str))
cls.manual(node, *... |
'Set the node\'s xsi:type attribute based on either I{value}\'s
class or the class of the node\'s text. Then adds the referenced
prefix(s) to the node\'s prefix mapping.
@param node: An XML node
@type node: L{sax.element.Element}
@param tval: The name of the schema type.
@type tval: str
@param ns: The XML namespace of... | @classmethod
def manual(cls, node, tval, ns=None):
| xta = ':'.join((NS.xsins[0], 'type'))
node.addPrefix(NS.xsins[0], NS.xsins[1])
if (ns is None):
node.set(xta, tval)
else:
ns = cls.genprefix(node, ns)
qname = ':'.join((ns[0], tval))
node.set(xta, qname)
node.addPrefix(ns[0], ns[1])
return node
|
'Generate a prefix.
@param node: An XML node on which the prefix will be used.
@type node: L{sax.element.Element}
@param ns: A namespace needing an unique prefix.
@type ns: (prefix, uri)
@return: The I{ns} with a new prefix.'
| @classmethod
def genprefix(cls, node, ns):
| for n in range(1, 1024):
p = ('ns%d' % n)
u = node.resolvePrefix(p, default=None)
if ((u is None) or (u == ns[1])):
return (p, ns[1])
raise Exception('auto prefix, exhausted')
|
'Process (marshal) the tag with the specified value using the
optional type information.
@param value: The value (content) of the XML node.
@type value: (L{Object}|any)
@param tag: The (optional) tag name for the value. The default is
value.__class__.__name__
@type tag: str
@return: An xml node.
@rtype: L{Element}'
| def process(self, value, tag=None):
| content = Content(tag=tag, value=value)
result = Core.process(self, content)
return result
|
'Suds client initialization.
Called after wsdl the has been loaded. Provides the plugin
with the opportunity to inspect/modify the WSDL.
@param context: The init context.
@type context: L{InitContext}'
| def initialized(self, context):
| pass
|
'Suds has loaded a WSDL/XSD document. Provides the plugin
with an opportunity to inspect/modify the unparsed document.
Called after each WSDL/XSD document is loaded.
@param context: The document context.
@type context: L{DocumentContext}'
| def loaded(self, context):
| pass
|
'Suds has parsed a WSDL/XSD document. Provides the plugin
with an opportunity to inspect/modify the parsed document.
Called after each WSDL/XSD document is parsed.
@param context: The document context.
@type context: L{DocumentContext}'
| def parsed(self, context):
| pass
|
'Suds will send the specified soap envelope.
Provides the plugin with the opportunity to inspect/modify
the envelope Document before it is sent.
@param context: The send context.
The I{envelope} is the envelope docuemnt.
@type context: L{MessageContext}'
| def marshalled(self, context):
| pass
|
'Suds will send the specified soap envelope.
Provides the plugin with the opportunity to inspect/modify
the message text it is sent.
@param context: The send context.
The I{envelope} is the envelope text.
@type context: L{MessageContext}'
| def sending(self, context):
| pass
|
'Suds has received the specified reply.
Provides the plugin with the opportunity to inspect/modify
the received XML text before it is SAX parsed.
@param context: The reply context.
The I{reply} is the raw text.
@type context: L{MessageContext}'
| def received(self, context):
| pass
|
'Suds has sax parsed the received reply.
Provides the plugin with the opportunity to inspect/modify
the sax parsed DOM tree for the reply before it is unmarshalled.
@param context: The reply context.
The I{reply} is DOM tree.
@type context: L{MessageContext}'
| def parsed(self, context):
| pass
|
'Suds has unmarshalled the received reply.
Provides the plugin with the opportunity to inspect/modify
the unmarshalled reply object before it is returned.
@param context: The reply context.
The I{reply} is unmarshalled suds object.
@type context: L{MessageContext}'
| def unmarshalled(self, context):
| pass
|
'@param plugins: A list of plugin objects.
@type plugins: [L{Plugin},]'
| def __init__(self, plugins):
| self.plugins = plugins
|
'@param name: The method name.
@type name: str
@param domain: A plugin domain.
@type domain: L{PluginDomain}'
| def __init__(self, name, domain):
| self.name = name
self.domain = domain
|
'@param kwargs: Keyword arguments.
- B{proxy} - An http proxy to be specified on requests.
The proxy is defined as {protocol:proxy,}
- type: I{dict}
- default: {}
- B{timeout} - Set the url open timeout (seconds).
- type: I{float}
- default: 90
- B{username} - The username used for http authentication.
- type: I{str}
-... | def __init__(self, **kwargs):
| HttpTransport.__init__(self, **kwargs)
self.pm = u2.HTTPPasswordMgrWithDefaultRealm()
|
'@param url: The url for the request.
@type url: str
@param message: The (optional) message to be send in the request.
@type message: str'
| def __init__(self, url, message=None):
| self.url = url
self.headers = {}
self.message = message
|
'@param code: The http code returned.
@type code: int
@param headers: The http returned headers.
@type headers: dict
@param message: The (optional) reply message received.
@type message: str'
| def __init__(self, code, headers, message):
| self.code = code
self.headers = headers
self.message = message
|
'Constructor.'
| def __init__(self):
| from suds.transport.options import Options
self.options = Options()
del Options
|
'Open the url in the specified request.
@param request: A transport request.
@type request: L{Request}
@return: An input stream.
@rtype: stream
@raise TransportError: On all transport errors.'
| def open(self, request):
| raise Exception('not-implemented')
|
'Send soap message. Implementations are expected to handle:
- proxies
- I{http} headers
- cookies
- sending message
- brokering exceptions into L{TransportError}
@param request: A transport request.
@type request: L{Request}
@return: The reply
@rtype: L{Reply}
@raise TransportError: On all transport errors.'
| def send(self, request):
| raise Exception('not-implemented')
|
'@param kwargs: Keyword arguments.
- B{proxy} - An http proxy to be specified on requests.
The proxy is defined as {protocol:proxy,}
- type: I{dict}
- default: {}
- B{timeout} - Set the url open timeout (seconds).
- type: I{float}
- default: 90'
| def __init__(self, **kwargs):
| Transport.__init__(self)
Unskin(self.options).update(kwargs)
self.cookiejar = CookieJar()
self.proxy = {}
self.urlopener = None
|
'Add cookies in the cookiejar to the request.
@param u2request: A urllib2 request.
@rtype: u2request: urllib2.Requet.'
| def addcookies(self, u2request):
| self.cookiejar.add_cookie_header(u2request)
|
'Add cookies in the request to the cookiejar.
@param u2request: A urllib2 request.
@rtype: u2request: urllib2.Requet.'
| def getcookies(self, fp, u2request):
| self.cookiejar.extract_cookies(fp, u2request)
|
'Open a connection.
@param u2request: A urllib2 request.
@type u2request: urllib2.Requet.
@return: The opened file-like urllib2 object.
@rtype: fp'
| def u2open(self, u2request):
| tm = self.options.timeout
url = self.u2opener()
if (self.u2ver() < 2.6):
socket.setdefaulttimeout(tm)
return url.open(u2request)
else:
return url.open(u2request, timeout=tm)
|
'Create a urllib opener.
@return: An opener.
@rtype: I{OpenerDirector}'
| def u2opener(self):
| if (self.urlopener is None):
return u2.build_opener(*self.u2handlers())
else:
return self.urlopener
|
'Get a collection of urllib handlers.
@return: A list of handlers to be installed in the opener.
@rtype: [Handler,...]'
| def u2handlers(self):
| handlers = []
handlers.append(u2.ProxyHandler(self.proxy))
return handlers
|
'Get the major/minor version of the urllib2 lib.
@return: The urllib2 version.
@rtype: float'
| def u2ver(self):
| try:
part = u2.__version__.split('.', 1)
n = float('.'.join(part))
return n
except Exception as e:
log.exception(e)
return 0
|
'Prepend schema object\'s from B{s}ource list to
the B{d}estination list while applying the filter.
@param d: The destination list.
@type d: list
@param s: The source list.
@type s: list
@param filter: A filter that allows items to be prepended.
@type filter: L{Filter}'
| @classmethod
def prepend(cls, d, s, filter=Filter()):
| i = 0
for x in s:
if (x in filter):
d.insert(i, x)
i += 1
|
'Append schema object\'s from B{s}ource list to
the B{d}estination list while applying the filter.
@param d: The destination list.
@type d: list
@param s: The source list.
@type s: list
@param filter: A filter that allows items to be appended.
@type filter: L{Filter}'
| @classmethod
def append(cls, d, s, filter=Filter()):
| for item in s:
if (item in filter):
d.append(item)
|
'@param schema: The containing schema.
@type schema: L{schema.Schema}
@param root: The xml root node.
@type root: L{Element}'
| def __init__(self, schema, root):
| self.schema = schema
self.root = root
self.id = objid(self)
self.name = root.get('name')
self.qname = (self.name, schema.tns[1])
self.min = root.get('minOccurs')
self.max = root.get('maxOccurs')
self.type = root.get('type')
self.ref = root.get('ref')
self.form_qualified = schema.... |
'Get only the attribute content.
@param filter: A filter to constrain the result.
@type filter: L{Filter}
@return: A list of tuples (attr, ancestry)
@rtype: [(L{SchemaObject}, [L{SchemaObject},..]),..]'
| def attributes(self, filter=Filter()):
| result = []
for (child, ancestry) in self:
if (child.isattr() and (child in filter)):
result.append((child, ancestry))
return result
|
'Get only the I{direct} or non-attribute content.
@param filter: A filter to constrain the result.
@type filter: L{Filter}
@return: A list tuples: (child, ancestry)
@rtype: [(L{SchemaObject}, [L{SchemaObject},..]),..]'
| def children(self, filter=Filter()):
| result = []
for (child, ancestry) in self:
if ((not child.isattr()) and (child in filter)):
result.append((child, ancestry))
return result
|
'Get (find) a I{non-attribute} attribute by name.
@param name: A attribute name.
@type name: str
@return: A tuple: the requested (attribute, ancestry).
@rtype: (L{SchemaObject}, [L{SchemaObject},..])'
| def get_attribute(self, name):
| for (child, ancestry) in self.attributes():
if (child.name == name):
return (child, ancestry)
return (None, [])
|
'Get (find) a I{non-attribute} child by name.
@param name: A child name.
@type name: str
@return: A tuple: the requested (child, ancestry).
@rtype: (L{SchemaObject}, [L{SchemaObject},..])'
| def get_child(self, name):
| for (child, ancestry) in self.children():
if (child.any() or (child.name == name)):
return (child, ancestry)
return (None, [])
|
'Get this properties namespace
@param prefix: The default prefix.
@type prefix: str
@return: The schema\'s target namespace
@rtype: (I{prefix},I{URI})'
| def namespace(self, prefix=None):
| ns = self.schema.tns
if (ns[0] is None):
ns = (prefix, ns[1])
return ns
|
'Get whether this node is unbounded I{(a collection)}
@return: True if unbounded, else False.
@rtype: boolean'
| def unbounded(self):
| max = self.max
if (max is None):
max = '1'
if max.isdigit():
return (int(max) > 1)
else:
return (max == 'unbounded')
|
'Get whether this type is optional.
@return: True if optional, else False
@rtype: boolean'
| def optional(self):
| min = self.min
if (min is None):
min = '1'
return (min == '0')
|
'Get whether this type is required.
@return: True if required, else False
@rtype: boolean'
| def required(self):
| return (not self.optional())
|
'Resolve and return the nodes true self.
@param nobuiltin: Flag indicates that resolution must
not continue to include xsd builtins.
@return: The resolved (true) type.
@rtype: L{SchemaObject}'
| def resolve(self, nobuiltin=False):
| return self.cache.get(nobuiltin, self)
|
'Get whether this is an <xs:sequence/>
@return: True if <xs:sequence/>, else False
@rtype: boolean'
| def sequence(self):
| return False
|
'Get whether this is an <xs:list/>
@return: True if any, else False
@rtype: boolean'
| def xslist(self):
| return False
|
'Get whether this is an <xs:all/>
@return: True if any, else False
@rtype: boolean'
| def all(self):
| return False
|
'Get whether this is n <xs:choice/>
@return: True if any, else False
@rtype: boolean'
| def choice(self):
| return False
|
'Get whether this is an <xs:any/>
@return: True if any, else False
@rtype: boolean'
| def any(self):
| return False
|
'Get whether this is a schema-instance (xs) type.
@return: True if any, else False
@rtype: boolean'
| def builtin(self):
| return False
|
'Get whether this is a simple-type containing an enumeration.
@return: True if any, else False
@rtype: boolean'
| def enum(self):
| return False
|
'Get whether the object is a schema I{attribute} definition.
@return: True if an attribute, else False.
@rtype: boolean'
| def isattr(self):
| return False
|
'Get whether the object is an extension of another type.
@return: True if an extension, else False.
@rtype: boolean'
| def extension(self):
| return False
|
'Get whether the object is an restriction of another type.
@return: True if an restriction, else False.
@rtype: boolean'
| def restriction(self):
| return False
|
'Get whether this I{mixed} content.'
| def mixed(self):
| return False
|
'Find a referenced type in self or children.
@param qref: A qualified reference.
@type qref: qref
@param classes: A list of classes used to qualify the match.
@type classes: [I{class},...]
@return: The referenced type.
@rtype: L{SchemaObject}
@see: L{qualify()}'
| def find(self, qref, classes=()):
| if (not len(classes)):
classes = (self.__class__,)
if ((self.qname == qref) and (self.__class__ in classes)):
return self
for c in self.rawchildren:
p = c.find(qref, classes)
if (p is not None):
return p
return None
|
'Translate a value (type) to/from a python type.
@param value: A value to translate.
@return: The converted I{language} type.'
| def translate(self, value, topython=True):
| return value
|
'Get a list of valid child tag names.
@return: A list of child tag names.
@rtype: [str,...]'
| def childtags(self):
| return ()
|
'Get a list of dependancies for dereferencing.
@return: A merge dependancy index and a list of dependancies.
@rtype: (int, [L{SchemaObject},...])'
| def dependencies(self):
| return (None, [])
|
'The list of I{auto} qualified attribute values.
Qualification means to convert values into I{qref}.
@return: A list of attibute names.
@rtype: list'
| def autoqualified(self):
| return ['type', 'ref']
|
'Convert attribute values, that are references to other
objects, into I{qref}. Qualfied using default document namespace.
Since many wsdls are written improperly: when the document does
not define a default namespace, the schema target namespace is used
to qualify references.'
| def qualify(self):
| defns = self.root.defaultNamespace()
if Namespace.none(defns):
defns = self.schema.tns
for a in self.autoqualified():
ref = getattr(self, a)
if (ref is None):
continue
if isqref(ref):
continue
qref = qualify(ref, self.root, defns)
log.d... |
'Merge another object as needed.'
| def merge(self, other):
| other.qualify()
for n in ('name', 'qname', 'min', 'max', 'default', 'type', 'nillable', 'form_qualified'):
if (getattr(self, n) is not None):
continue
v = getattr(other, n)
if (v is None):
continue
setattr(self, n, v)
|
'Get a I{flattened} list of this nodes contents.
@param collection: A list to fill.
@type collection: list
@param filter: A filter used to constrain the result.
@type filter: L{Filter}
@param history: The history list used to prevent cyclic dependency.
@type history: list
@return: The filled list.
@rtype: list'
| def content(self, collection=None, filter=Filter(), history=None):
| if (collection is None):
collection = []
if (history is None):
history = []
if (self in history):
return collection
history.append(self)
if (self in filter):
collection.append(self)
for c in self.rawchildren:
c.content(collection, filter, history[:])
r... |
'Get a string representation of this object.
@param indent: The indent.
@type indent: int
@return: A string.
@rtype: str'
| def str(self, indent=0, history=None):
| if (history is None):
history = []
if (self in history):
return ('%s ...' % Repr(self))
history.append(self)
tab = ('%*s' % ((indent * 3), ''))
result = []
result.append(('%s<%s' % (tab, self.id)))
for n in self.description():
if (not hasattr(self, n)):
... |
'Get the names used for str() and repr() description.
@return: A dictionary of relavent attributes.
@rtype: [str,...]'
| def description(self):
| return ()
|
'@param sx: A schema object.
@type sx: L{SchemaObject}'
| def __init__(self, sx):
| self.sx = sx
self.items = sx.rawchildren
self.index = 0
|
'Get the I{next} item in the frame\'s collection.
@return: The next item or None
@rtype: L{SchemaObject}'
| def next(self):
| if (self.index < len(self.items)):
result = self.items[self.index]
self.index += 1
return result
|
'@param sx: A schema object.
@type sx: L{SchemaObject}'
| def __init__(self, sx):
| self.stack = []
self.push(sx)
|
'Create a frame and push the specified object.
@param sx: A schema object to push.
@type sx: L{SchemaObject}'
| def push(self, sx):
| self.stack.append(Iter.Frame(sx))
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.