[Grok-dev] Re: Vocabulary registration

Philipp von Weitershausen philipp at weitershausen.de
Wed Mar 14 07:51:14 EDT 2007


Martijn Faassen wrote:
>> I'm struggling a little here registering a vocabulary for use in a form.
>> I'm reusing code that I'd previously used and trying to twig it to work
>> with grok.
>>
> 
> As a general note, the way vocabularies work needs work in Grok (or 
> sources, their successor in Zope 3). That is, I consider it rather too 
> difficult to set them up in Zope 3 now, and we should provide an easier 
> way for Grok.
> 
> Anyone any thoughts on how to do this with sources?

Sources should work right away since they don't have the name-based 
lookup through the utility registry. The Choice field accepts several 
things as the 'source' parameter:

- a source object (providing ISource). This is useful for when the 
source is pretty much not dependend on the object that you're currently 
trying to validate.

- a source factory (providing IContextSourceBinder). This is a callable 
that take the current context (the object you're trying to validate) and 
returns a source.


-- 
http://worldcookery.com -- Professional Zope documentation and training


More information about the Grok-dev mailing list