[Zope3-Users] Interfaces in Schemas

Darryl Cousins darryl at darrylcousins.net.nz
Wed Apr 18 17:24:09 EDT 2007


Hi,

On Wed, 2007-04-18 at 09:21 -0700, Martin Aspeli wrote:
> 
> 
> Hermann Himmelbauer wrote:
> > 
> > Hi,
> > I wonder if it's possible to define attributes in a schema that reference 
> > other interfaces. For instance, I have a schema for a car and another one
> > for 
> > a wheel and what I want to do is something like that:
> > 
> > class IWheel(Interface):
> >        type = TextLine()
> > 
> > class ICar(Interface):    
> >     
> >        model = TextLine()
> > 
> >        wheel = ??? of type IWheel ???    
> > 
> 
> wheel = schema.Object(schema=IWheel)
> 
> 
> 
> > or even better:
> >        wheel = List(min_length=4, max_length=4, 
> >                             value_type = ??? of type IWheel???)
> > 
> 
> value_type=schema.Object(schema=IWheel)
> 
> 
> 
> > What would be really great now is if formlib could handle this and would 
> > automatically set up the needed widgets.
> > 
> 
> Not sure what it does; I think you'd need to write some custom reference
> widget type thing; you can't "fill in a wheel", really. :) Where would the
> Wheel objects come from?
> 

This tutorial will be enough to get you started with a custom widget for
your List->Object field.

http://zope3.mpg.de/cgi-bin/twiki/view/Zope/KomplexerContent

Best regards,
Darryl

> Martin



More information about the Zope3-users mailing list