From 57b3e523b71bac180d0d688a7e0920d44342963d Mon Sep 17 00:00:00 2001 From: Andrea Cecchi Date: Tue, 3 Dec 2024 13:40:22 +0100 Subject: [PATCH] Do not break slate linkintegrity if block is not a slate block --- src/plone/restapi/blocks_linkintegrity.py | 3 +-- src/plone/restapi/deserializer/blocks.py | 7 ++++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plone/restapi/blocks_linkintegrity.py b/src/plone/restapi/blocks_linkintegrity.py index 754f5c256b..dc5343ff1d 100644 --- a/src/plone/restapi/blocks_linkintegrity.py +++ b/src/plone/restapi/blocks_linkintegrity.py @@ -69,9 +69,8 @@ def __init__(self, context, request): def __call__(self, block): value = (block or {}).get(self.field, []) children = iterate_children(value or []) - for child in children: - node_type = child.get("type") + node_type = child.get("type", "") if node_type: handler = getattr(self, f"handle_{node_type}", None) if handler: diff --git a/src/plone/restapi/deserializer/blocks.py b/src/plone/restapi/deserializer/blocks.py index 59e26a807c..e4a8f825be 100644 --- a/src/plone/restapi/deserializer/blocks.py +++ b/src/plone/restapi/deserializer/blocks.py @@ -24,9 +24,10 @@ def iterate_children(value): queue = deque(value) while queue: child = queue.pop() - yield child - if child.get("children"): - queue.extend(child["children"] or []) + if isinstance(child, dict): + yield child + if child.get("children", []): + queue.extend(child["children"] or []) @implementer(IFieldDeserializer)