diff --git a/src/redturtle/volto/upgrades.py b/src/redturtle/volto/upgrades.py index 5ed2abf..73d900a 100644 --- a/src/redturtle/volto/upgrades.py +++ b/src/redturtle/volto/upgrades.py @@ -562,8 +562,9 @@ def should_reindex(blocks): if i % 100 == 0: logger.info(f"Progress: {i}/{tot}") - if should_reindex(blocks=getattr(obj, "blocks", {})): - reindex = True + if getattr(obj, "blocks", {}): + if should_reindex(blocks=getattr(obj, "blocks", {})): + reindex = True for schema in iterSchemata(obj): for name, field in getFields(schema).items(): if name == "blocks": @@ -576,9 +577,10 @@ def should_reindex(blocks): value = field.get(obj) try: blocks = value.get("blocks", {}) - if should_reindex(blocks): - reindex = True - break + if blocks: + if should_reindex(blocks): + reindex = True + break except AttributeError: logger.warning( f"[RICHTEXT] - {brain.getURL()} (should not reindexed)"