[spyne] Serializing a model

Joseph L. Casale jcasale at activenetwerx.com
Thu Jun 19 16:53:49 UTC 2014


> huh. this is supposed to work, the sole purpose of XmlData is to have
> whatever's inside as simpleContent.
> 
> See: https://gist.github.com/plq/11e4c28d5eeba7d145a7

> class Node(ComplexModel):
>     ATTR = XmlAttribute(Unicode)
>     data = XmlData(Unicode(max_len=450, values=['1st', '2nd']))

Hey Burak,
Solved it, the values param needed to be passed to the XmlAttribute Unicode
instance, then as the real attribute name is a python reserved word, the whole
lot was stuffed in a _type_info.

Now the get_object_as_dict method serializes the Node model as a list of dicts
indicating the correlated attribute value which is exactly what I needed.

Thanks!
jlc


More information about the people mailing list