I have some news items imported from Plone 4 to Plone 6 and I discovered a bug when trying to edit an old item. Edit - save - edit... and the items is broken with some strange values on blocks - blocks_layout.
I want to remove the values, but with no success:
First try:
(Pdb) news_item
<FolderishNewsItem at /Plone/sandbox1/news/test-news-item>
(Pdb) hasattr(news_item, 'blocks')
True
(Pdb) news_item.blocks
{'89ec635f-0a69-4a72-a8fe-7e477a0ea0de': {'@type': 'title'}, 'undefined': {'@type': 'title'}, '72d988ce-e065-43d3-a9d0-975d49da6e52': {'@type': 'slate'}}
(Pdb) delattr(news_item, 'blocks')
*** AttributeError: 'FolderishNewsItem' object has no attribute 'blocks'
Second:
(Pdb) news_item
<FolderishNewsItem at /Plone/sandbox1/news/test-news-item>
(Pdb) item = news_item.aq_inner.aq_self
(Pdb) item
<FolderishNewsItem at test-news-item>
(Pdb) item.blocks
{'89ec635f-0a69-4a72-a8fe-7e477a0ea0de': {'@type': 'title'}, 'undefined': {'@type': 'title'}, '72d988ce-e065-43d3-a9d0-975d49da6e52': {'@type': 'slate'}}
(Pdb) delattr(item, 'blocks')
*** AttributeError: 'FolderishNewsItem' object has no attribute 'blocks'
How can I reset these fields? I found them here: plone.restapi/src/plone/restapi/behaviors.py at main · plone/plone.restapi · GitHub