[spyne] Serializing a model

Joseph L. Casale jcasale at activenetwerx.com
Thu Jun 19 14:30:30 UTC 2014


> `attribute_of` is deprecated as of 2.11. XmlData is fully functional but
> nobody but a select number of people know of its existence :) (it's
> nowhere in the docs yet)

Hey Burak,
You showed me this before but the resulting format is not exactly like what the
client requires.

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

What I get is a wsdl like this:

  <urn1:Node ATTR="?">
    <spy:data/>
  </urn1:Node>

Whereas the element must not be nested:

<Node ATTR="1st">foo</Node>

Thats why I reverted to using attribute_of knowing it was on its way out.

Thanks!
jlc


More information about the people mailing list