Found a bug? Please fill out the sections below. 馃憤
update_index fails on StreamField TableBlock when its value is None, due to this line: https://github.com/wagtail/wagtail/blob/master/wagtail/contrib/table_block/blocks.py#L79
Throws AttributeError: 'NoneType' object has no attribute 'get'
python manage.py update_index, you will get a traceback leading to the above AttributeError
Wagtail version: 2.2.2
Ran into same issue, so can confirm!
Also ran into this. Further, the empty TableBlock is rendered on-page as 'None', which is less serious but more complex to fix.
We've observed this in a draft page which even though more recent revisions had removed the empty block, still caused the overnight update_index job to fail.
Workaround to stop search indexing breaking:
_tableblock_get_searchable_content = TableBlock.get_searchable_content
def _safe_tableblock_get_searchable_content(self, value):
if value is not None:
return _tableblock_get_searchable_content(self, value)
else:
return []
TableBlock.get_searchable_content = _safe_tableblock_get_searchable_content
Fixed in #5757.
Most helpful comment
Fixed in #5757.