I'm working on a behavior that will add some fields to a content type; 2 of these fields (document_type and document_subtype) are used to classify an item.
the document_subtype field could have different values depending on the value of the document_type field; I'm trying to do this using plone.formwidget.masterselect but I found the documentation pretty confusing.
for instance:
document_type can be A, B or C
if document_type is A, then document_subtype could be A1, A2 or A3
if document_type is B, then document_subtype could be B1 or B2
if document_type is C, then document_subtype could be C1, C2, C3 or C4
setup(
name='plone.formwidget.masterselect',
version=version,
description='A z3c.form widget that controls the vocabulary or '
'display of other fields on an edit page',
my bad again, I'm misunderstanding everything... anyway, when I test your solutions I get:
2017-06-26 13:43:26 ERROR Zope.SiteErrorLog 1498495406.50.503926074686 http://localhost:8080/Plone/library/++add++File/++widget++ILibrary.document_type/@@masterselect-jsonvalue
Traceback (innermost last):
Module ZPublisher.Publish, line 138, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 48, in call_object
Module plone.formwidget.masterselect.widget, line 251, in __call__
ValueError: Can not find widget: document_subtype
I can't test right now, but I will do so tomorrow morning.
One thing that you could try regarding your vocabularies: If the return value of self.getVocabulary is already a vocabulary, and not a list/tuple, everything is fine.