On 2011-07-22 13:26, Brian Sutherland wrote:
> This would be my first guess:
> 
>     class INode(Interface):
>         pass
>      
>     INode.parent = Object(
>             title=u"Parent node",
>             schema=INode
>             )
> 
>     INode.children = List(
>             title=u'Child nodes',
>             value_type=Object(schema=INode)
>             )
> 


And that guess would be wrong.  You can't add fields to an existing
schema like that (not sure if you can in other ways).  You *can* change
an existing field however, so a working solution would be:

    class INode(Interface):

        parent = Object(
            title = u'Parent node',
            schema = Interface, # set to INode later
            )

        children = List(
            title = u'Child nodes',
            value_type = Object(schema=Interface), # set to INode later
            )

    INode['parent'].schema = INode
    INode['children'].value_type.schema = INode


Hope this helps

  - Jacob
_______________________________________________
bluebream mailing list
[email protected]
https://mail.zope.org/mailman/listinfo/bluebream

Reply via email to