plone / plone.jsonserializer

JSON Serialization/Deserialization resources for Plone
3 stars 1 forks source link

Serialize RelationValue #1

Open jensens opened 7 years ago

jensens commented 7 years ago

a z3c.relationsfield,reation.RelationValue is not serializeable. This would be good. Otherwise Mosaic can not store Relations.

espenmn commented 6 years ago

Is this difficult to fix? (if not, I could give it a try)

djay commented 6 years ago

Also hit this one. I guess it should use the resolveuid urls? (which ideally should include both path and uid to be more robust)

espenmn commented 5 years ago

RelationValues work in Mosaic (but not RelationList)

mtrebron commented 3 years ago

This is still an issue after 4 years.

Traceback (innermost last):
  Module ZPublisher.WSGIPublisher, line 162, in transaction_pubevents
  Module ZPublisher.WSGIPublisher, line 371, in publish_module
  Module ZPublisher.WSGIPublisher, line 266, in publish
  Module ZPublisher.mapply, line 85, in mapply
  Module ZPublisher.WSGIPublisher, line 63, in call_object
  Module plone.z3cform.layout, line 63, in __call__
  Module plone.z3cform.layout, line 47, in update
  Module plone.app.tiles.browser.edit, line 51, in update
  Module plone.app.tiles.browser.base, line 104, in update
  Module plone.z3cform.fieldsets.extensible, line 65, in update
  Module plone.z3cform.patch, line 30, in GroupForm_update
  Module z3c.form.group, line 145, in update
  Module plone.app.z3cform.csrf, line 22, in execute
  Module z3c.form.action, line 98, in execute
  Module z3c.form.button, line 315, in __call__
  Module z3c.form.button, line 170, in __call__
  Module plone.app.tiles.browser.edit, line 97, in handleSave
  Module plone.tiles.data, line 135, in set
  Module plone.app.blocks.layoutbehavior, line 448, in __setitem__
  Module plone.jsonserializer.serializer.converters, line 61, in json_compatible
  Module zope.component.hooks, line 135, in adapter_hook
  Module plone.jsonserializer.serializer.converters, line 129, in dict_converter
  Module plone.jsonserializer.serializer.converters, line 129, in <listcomp>
  Module plone.jsonserializer.serializer.converters, line 61, in json_compatible
  Module zope.component.hooks, line 135, in adapter_hook
  Module plone.jsonserializer.serializer.converters, line 80, in default_converter
TypeError: No converter for making <z3c.relationfield.relation.RelationValue object at 0x7f336c100580> (<class 'z3c.relationfield.relation.RelationValue'>) JSON compatible.

I suppose the approach taken here would be acceptable? https://plonerestapi.readthedocs.io/en/latest/serialization.html#relations