[Zope3-Users] Re: A gentle push in the right direction needed

Tim Penhey tim at penhey.net
Thu Jul 20 01:51:39 EDT 2006


On Thursday 20 July 2006 00:01, Philipp von Weitershausen wrote:
> Tim Penhey wrote:
> >     postal_address = InterfaceField(
> >         title=u"Postal Address"
> >         )
>
> Use zope.schema.Object here:
>
>   postal_address = Object(
>       title=u"...",
>       schema=IAddress
>       )

Ah, this is the bit I was missing.  Thanks Philipp.

> You can then have the this subobject's widget rendered as a subform by
> the ObjectWidget. You'll have to give ObjectWidget a constructor that it
> will call in case it has to create an IAddress object.

Definitely something I'll be looking to do when I get to that part of the 
code.

> > Now it is with the postal_address I hit my first snag.  I really want to
> > say that it is an IAddress.  Am I using InterfaceField correctly here? 
> > Is there an option to specify the type of the interface?
> >
> > Also how do I specify a list of addresses?
>
>   addresses = List(
>       title=u"...",
>       value_type=Object(schema=IAdress),
>       )

Simple again (once you know :-) ).

Thanks,
Tim


More information about the Zope3-users mailing list