diff --git a/src/plone/restapi/serializer/dxcontent.py b/src/plone/restapi/serializer/dxcontent.py index 5135d69adf..c8b60f9e9e 100644 --- a/src/plone/restapi/serializer/dxcontent.py +++ b/src/plone/restapi/serializer/dxcontent.py @@ -5,6 +5,7 @@ from plone.dexterity.interfaces import IDexterityContainer from plone.dexterity.interfaces import IDexterityContent from plone.dexterity.utils import iterSchemata +from plone.restapi import HAS_PLONE_6 from plone.restapi.batching import HypermediaBatch from plone.restapi.deserializer import boolean_value from plone.restapi.interfaces import IFieldSerializer @@ -42,9 +43,16 @@ def update_with_working_copy_info(context, result): - if WorkingCopyInfo is not None: - baseline, working_copy = WorkingCopyInfo(context).get_working_copy_info() - result.update({"working_copy": working_copy, "working_copy_of": baseline}) + if WorkingCopyInfo is None: + return + + # Does not return working copy information when serializing Portal in Plone 5.2. + if not HAS_PLONE_6 and context.portal_type == "Plone Site": + return + + working_copy_info = WorkingCopyInfo(context) + baseline, working_copy = working_copy_info.get_working_copy_info() + result.update({"working_copy": working_copy, "working_copy_of": baseline}) def get_allow_discussion_value(context, request, result):