I have a schema field like
gl_guideline_topics = schema.List(
title=_("Guideline topics"),
description=_("Guideline topics"),
required=False,
default=[],
value_type=schema.Choice(source=get_guideline_topics_vocab),
)
which causes this NotImplementedError
:
>>> print(serializeSchema(IGuideline))
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/ajung/sandboxes/onkopedia_buildout-plone5/eggs/plone.supermodel-1.6.3-py3.8.egg/plone/supermodel/__init__.py", line 41, in serializeSchema
return serializeModel(model.Model({name: schema}))
File "/home/ajung/sandboxes/onkopedia_buildout-plone5/eggs/plone.supermodel-1.6.3-py3.8.egg/plone/supermodel/__init__.py", line 45, in serializeModel
return serializer.serialize(model)
File "/home/ajung/sandboxes/onkopedia_buildout-plone5/eggs/plone.supermodel-1.6.3-py3.8.egg/plone/supermodel/serializer.py", line 116, in serialize
writeField(field, fieldset_element)
File "/home/ajung/sandboxes/onkopedia_buildout-plone5/eggs/plone.supermodel-1.6.3-py3.8.egg/plone/supermodel/serializer.py", line 70, in writeField
fieldElement = handler.write(field, fieldName, fieldType)
File "/home/ajung/sandboxes/onkopedia_buildout-plone5/eggs/plone.supermodel-1.6.3-py3.8.egg/plone/supermodel/exportimport.py", line 204, in write
child = self.writeAttribute(attributeField, field)
File "/home/ajung/sandboxes/onkopedia_buildout-plone5/eggs/plone.supermodel-1.6.3-py3.8.egg/plone/supermodel/exportimport.py", line 241, in writeAttribute
return handler.write(
File "/home/ajung/sandboxes/onkopedia_buildout-plone5/eggs/plone.supermodel-1.6.3-py3.8.egg/plone/supermodel/exportimport.py", line 437, in write
raise NotImplementedError(
NotImplementedError: Choice fields with vocabularies not based on a simple list of values or a named vocabulary cannot be exported
vocabulary
is in my case a method providing IContextSourceBinder
. Wouldn't it make sense to just export the name of the source
here (aka the method name, better: it's dotted name) instead of throwing an exception? Or is there something special complexity hidden here?