I have a lot of dynamic sources along the lines shown in the Dexterity developer manual here https://docs.plone.org/external/plone.app.dexterity/docs/advanced/vocabularies.html#dynamic-sources. Just a function that is context-aware and returns a vocabulary. This works fine in the usual add/edit forms for the content type. But I also have some of code that attempts to build a new form based on parts of a content schema, to do mass edits. It will get a widget like this which can be rendered directly:
field = IMyInterface['field']
widget = getMultiAdapter((field, self.request), IFieldWidget)
widget.update()
This works in 5.1 but in 5.2 it fails validation, due to what looks like an update in zope.schema._field.Choice's validation.
Traceback (innermost last):
Module ZPublisher.WSGIPublisher, line 155, in transaction_pubevents
Module ZPublisher.WSGIPublisher, line 337, in publish_module
Module ZPublisher.WSGIPublisher, line 255, in publish
Module ZPublisher.mapply, line 85, in mapply
Module ZPublisher.WSGIPublisher, line 61, in call_object
Module ims.fieldupdater.browser.mass, line 28, in __call__
Module Products.Five.browser.pagetemplatefile, line 126, in __call__
Module Products.Five.browser.pagetemplatefile, line 61, in __call__
Module zope.pagetemplate.pagetemplate, line 135, in pt_render
Module Products.PageTemplates.engine, line 88, in __call__
Module z3c.pt.pagetemplate, line 173, in render
Module chameleon.zpt.template, line 306, in render
Module chameleon.template, line 209, in render
Module chameleon.utils, line 75, in raise_with_traceback
Module chameleon.template, line 187, in render
Module 6dffeae47701c9dc8464c4b9dccef94e.py, line 2050, in render
Module 5c4dfcdbef155018902625d254565f06.py, line 284, in render_master
Module 927f9f167c8e9d53f313dd3edc43e383.py, line 687, in render_master
Module 5c4dfcdbef155018902625d254565f06.py, line 264, in __fill_content
Module 927f9f167c8e9d53f313dd3edc43e383.py, line 1273, in render_content
Module 5c4dfcdbef155018902625d254565f06.py, line 255, in __fill_main
Module 6dffeae47701c9dc8464c4b9dccef94e.py, line 1917, in __fill_prefs_configlet_main
Module ims.fieldupdater.browser.mass, line 346, in replacement_widget
Module z3c.form.browser.select, line 51, in update
Module z3c.form.browser.widget, line 171, in update
Module z3c.form.widget, line 233, in update
Module z3c.form.widget, line 227, in updateTerms
Module zope.component._api, line 95, in getMultiAdapter
Module zope.component._api, line 108, in queryMultiAdapter
Module zope.interface.registry, line 359, in queryMultiAdapter
Module zope.interface.adapter, line 552, in queryMultiAdapter
Module z3c.form.term, line 105, in ChoiceTerms
Module zope.schema._field, line 507, in bind
Module zope.schema._field, line 498, in _resolve_vocabulary
zope.schema._field.InvalidVocabularyError: zope.schema._field.InvalidVocabularyError: Invalid vocabulary <function contact_categories at 0x7f5a186a7f28>
It fails because the returned vocabulary does not provide ISource, which again looks like a new addition to the validation. So it's not clear to me if I should be converting my IContextSourceBinder functions into a class that also implements ISource (or convert it into a named vocabulary), or if the problem is somehow with the mass edit code that tries to extract and render a single widget. Or, perhaps, the problem is an overly aggressive validator in zope.schema but I don't know what I'd be able to do about that.