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

_______________________________________________
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to