Hi,

I am trying to create a spyne model with a tree data structure.
Basically, this is what I'd like to do:

class Category(ComplexModel):
    category_id = Integer(min_occurs=1, max_occurs=1, nillable=False)
    name = Unicode(min_occurs=1, max_occurs=1, nillable=False)
    children = Array(Category)

The above obviously doesn't work. However, I noticed that there is a
SelfReference data type. So I tried this:

class Category(ComplexModel):
    category_id = Integer(min_occurs=1, max_occurs=1, nillable=False)
    name = Unicode(min_occurs=1, max_occurs=1, nillable=False)
    children = Array(SelfReference)

But that dies with:

  File 
"/Library/Python/2.7/site-packages/spyne-2.10.0-py2.7.egg/spyne/model/complex.py",
line 685, in __new__
    if serializer.Attributes.max_occurs == 1:
AttributeError: type object 'SelfReference' has no attribute 'Attributes'

So it looks like SelfReference doesn't work within an Array. Is there
any other way to do this? If not, would it be possible to add support
for Array(SelfReference) in a future version of spyne?

Thanks,
Ken
_______________________________________________
Soap mailing list
[email protected]
http://mail.python.org/mailman/listinfo/soap

Reply via email to