Skip to content

Commit

Permalink
Do not break slate linkintegrity if block is not a slate block
Browse files Browse the repository at this point in the history
  • Loading branch information
cekk committed Dec 3, 2024
1 parent 447a87c commit 57b3e52
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/plone/restapi/blocks_linkintegrity.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 4 additions & 3 deletions src/plone/restapi/deserializer/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 57b3e52

Please sign in to comment.