collective.multiworkflow.restapi.serializer#
collective.multiworkflow.restapi.serializer.dxcontent#
Add workflow_states to plone.restapi's content serialization.
The key sits beside review_state in the payload of every Dexterity object,
carrying the object's state in every workflow of its chain, formatted as the
workflow_states catalog index holds it.
The patch wraps SerializeToJson.__call__ on the class itself, rather than
binding a subclass in its place. SerializeFolderToJson,
SerializeCollectionToJson and any serializer an add-on derives from them
reach it through super().__call__, so they all carry the key. And because
plone.restapi's ZCML registers the very class that was patched, the order in
which the two packages are configured does not matter.
A subclass overriding __call__ without calling super() does not carry
the key. Nothing short of patching that subclass as well could change that.
The patch is applied when collective.multiworkflow.restapi.serializer is
imported, which including its ZCML does.
collective.multiworkflow.restapi.serializer.summary#
Summary serializer metadata for listings.
Adds the workflow_states catalog column to every ISerializeToJsonSummary
payload, so a listing can show each item's state in every workflow of its chain
without one request per item.