From 88ca99e60b23b7449e68e9457274b54bf8af3d42 Mon Sep 17 00:00:00 2001 From: wesleybl Date: Tue, 8 Oct 2024 19:08:18 -0300 Subject: [PATCH] Does not return working copy information when serializing Portal in Plone 5.2 --- src/plone/restapi/serializer/dxcontent.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/plone/restapi/serializer/dxcontent.py b/src/plone/restapi/serializer/dxcontent.py index 9f0e700bb..d801a29fd 100644 --- a/src/plone/restapi/serializer/dxcontent.py +++ b/src/plone/restapi/serializer/dxcontent.py @@ -6,6 +6,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 @@ -43,9 +44,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):