[Zope3-dev] Schema & Vocabulary Fields

Gary Poster gary at zope.com
Tue Sep 9 18:51:43 EDT 2003



Roché Compaan wrote:
> Are there any examples that show how to use Vocabulary Fields that
> return options dynamically. There's a lot of indirection in the code and
> only examples that show how to use simple vocabularies. It seems that
> one has to do quite a lot to construct simple lookup widgets - I hope
> this is not so.
> 
> I am specifically interested in an example where an object has a
> reference or references to instances of other objects eg. Product X has
> Components 1,2 and 3.

It sounds like what you want is a couple of accessors or a property or 
some other sort of descriptor.  References don't inherently have 
anything to do with a vocabulary.  A vocabulary just lets you define the 
members of the set of possible values.

For guidance on how to use vocabularies, though, you won't find much 
better than the complex sample Fred put in 
zope/app/browser/form/complexsample.  The vocabulary isn't dynamic, but 
you can see that a context is passed to it--it could easily use that 
context to do dynamic things.

Gary




More information about the Zope3-dev mailing list