[Zope3-dev] <vocabulary> BBB

dev at projekt01.ch dev at projekt01.ch
Tue May 16 08:25:15 EDT 2006


Hi Adam 

> Behalf Of Adam Groszer
> Sent: Tuesday, May 16, 2006 8:32 AM
> To: zope3-dev
> Subject: [Zope3-dev] <vocabulary> BBB
> 
> Hi there,
> 
> I'm working on removing BBB warnings of our current app for 3.3.
> For the <vocabulay> directive it was possible to give the 
> factory some parameters like this:
> 
> <vocabulary
>       name="doctype"
>       factory="..vocab.ContainerVocabulary"
>       containerName="doctype" />
> 
> Now, with the <utility> directive that's not possible.

Write a own factory like:

class DocTypeContainerVocabulary(ContainerVocabulary):

  def __init__(self):
	super(DocTypeContainerVocabulary, self).__init__()
	self.containerName = 'doctype'



and also you have to *patch* your class with :

classProvides(DocTypeContainerVocabulary, IVocabularyFactory)



then use the factory like:

<utility
    name="doctype"
    factory="..vocab.DocTypeContainerVocabulary" />


It's simple isn't it?

the *good* thing is if you use this vocabulary for 
twenty vocabularies, you have to do this for each 
of them. This is realy ugly, but simple. 

Regards
Roger Ineichen



More information about the Zope3-dev mailing list