[Product-Developers] Re: Different NamedVocabulary for each instance of product

Raphael Ritz r.ritz at biologie.hu-berlin.de
Wed Oct 1 12:13:11 UTC 2008


Johannes Schwenk wrote:
> Hello,
> 
> I am using archgenxml-2.1 and ArgoUML to design my content type. My system 
> configuration:
> 
> Plone 3.1.4
> CMF 2.1.1
> Zope (Zope 2.10.6-final, python 2.4.4, linux2)
> Python 2.4.4 (#1, Jan 28 2008, 15:57:09) [GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)]
> PIL 1.1.6
> 
> I am developing a content type which requires a tree-like vocabulary for each 
> instance. I know about the tagged values 'vocabulary:name' 
> and 'vocabulary:type' to get a vocabulary from ATVocabularyManager assigned 
> to a field. But this produces something like:
> 
>     StringField(
>         name='VocabName',
>         mutator='setVocabulary',
>         widget=StringField._properties['widget'](
>             label='Vocabname',
>             label_msgid='PloneCategorizer_label_VocabName',
>             i18n_domain='PloneCategorizer',
>         ),
>     ),
>     LinesField(
>         name='Vocab',
>         widget=PicklistWidget(
>             label='Vocab',
>             label_msgid='PloneCategorizer_label_Vocab',
>             i18n_domain='PloneCategorizer',
>         ),
>         write_permission="ManagePortal",
>         vocabulary=NamedVocabulary("""default"""),
>     ),
> 
> in the schema of the type. I would like to (re-)set the 'vocabulary' attribute 
> of the 'Vocab' field every time the value of the 'VocabName' field changes. 
> Is that possible and how could I do this?
> 
> Sorry, I'm still new to this and struggling hard ;-)!

Not sure I understand correctly what you want but either using

   http://plone.org/products/masterselectwidget

or providing a custom mutator for your VocabName field
(the 'setVocabulary' method which then changes the
other field's settings) should do the job.

Raphael


> 
> Johannes





More information about the Product-Developers mailing list