The spyne.model.complex module contains spyne.model.complex.ComplexBase class and its helper objects and subclasses. These are mainly container classes for other simple or complex objects – they don’t carry any data by themselves.
Bases: spyne.model.complex.ComplexModelBase
This class generates a ComplexModel child that has one attribute that has the same name as the serialized class. It’s contained in a Python list.
Bases: spyne.model.complex.ComplexModelBase
The general complexType factory. The __call__ method of this class will return instances, contrary to primivites where the same call will result in customized duplicates of the original class definition. Those who’d like to customize the class should use the customize method. (see :class:spyne.model.ModelBase).
Bases: spyne.model._base.ModelBase
If you want to make a better class type, this is what you should inherit from.
Bases: spyne.model._base.Attributes
ComplexModel-specific attributes
Customize child attributes in one go. It’s a dict of dicts. This is ignored unless used via explicit customization.
The order fields of the :class:ComplexModel are to be declared in the SOAP WSDL. If this is left as None or explicitly set to 'random' declares then the fields appear in whatever order the Python’s hash map implementation seems fit in the WSDL. This randomised order can change every time the program is run. This is what Spyne <2.11 did if you didn’t set _type_info as an explicit sequence (e.g. using a list, odict, etc.). It means that clients who are manually complied or generated from the WSDL will likely need to be recompiled every time it changes. The string name means the field names are alphabetically sorted in the WSDL declaration. The string declared means in the order the field type was declared in Python 2, and the order the field was declared in Python 3.
In order to get declared field order in Python 2, the spyne.util.meta.Preparable class inspects the frame stack in order to locate the class definition, re-parses it to get declaration order from the AST and uses that information to order elements.
It’s a horrible hack that we tested to work with CPython 2.6 through 3.3 and PyPy. It breaks in Nuitka as Nuitka does away with code objects. Other platforms were not tested.
It’s not recommended to use set this to 'declared' in Python 2 unless you’re sure you fully understand the consequences.
FIXME: document me yo.
FIXME: document me yo.
The sqlalchemy mapper object
A dict that will be passed to sqlalchemy.orm.mapper() constructor as. **kwargs.
None or sqlalchemy.MetaData instance.
The sqlalchemy table object
A dict that will be passed to sqlalchemy.schema.Table constructor as **kwargs.
When False, soft validation ignores missing mandatory attributes.
Duplicates cls and overwrites the values in cls.Attributes with **kwargs and returns the new class.
Get an empty native type so that the deserialization logic can set its attributes.
Returns the native object corresponding to the serialized form passed in the value argument.
Parameters: | value – This argument can be: * A list or tuple of native types aligned with cls._type_info. * A dict of native types. * The native type itself. If the value type is not a list, tuple or dict, the value is returned untouched. |
---|
Bases: spyne.util.meta.NewBase
This metaclass sets _type_info, __type_name__ and __extends__ which are going to be used for (de)serialization and schema generation.
Bases: spyne.model.complex.Array
This class generates a ComplexModel child that has one attribute that has the same name as the serialized class. It’s contained in a Python iterable. The distinction with the Array is made in the protocol implementation, this is just a marker.
Whenever you return a generator instead of a list, you should use this type as this suggests the intermediate machinery to NEVER actually try to iterate over the value. An Array could be iterated over for e.g. logging purposes.
Customizes the given type to be a mandatory one. Has special cases for spyne.model.primitive.Unicode and spyne.model.complex.Array.
Bases: object
Use this as a placeholder type in classes that contain themselves. See spyne.test.model.test_complex.TestComplexModel.test_self_reference().
Bases: spyne.model.complex.XmlModifier
Items which are marshalled as attributes of the parent element. If attribute_of is passed, it’s marshalled as the attribute of the element with given name.
Bases: spyne.model.complex.XmlAttribute
Reference to an Xml attribute.