Clean-up corrupt empty BTreeFolder2 instances on path import (approved by jm)

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30236 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent fdc9a271
......@@ -894,6 +894,15 @@ class ObjectTemplateItem(BaseTemplateItem):
# because they change when we add subobjects
groups[path] = deepcopy(obj.groups)
# copy the object
if (getattr(aq_base(obj), '_mt_index', None) is not None and
obj._count() == 0):
# some btrees were exported in a corrupted state. They're empty but
# their metadata-index (._mt_index) contains entries which in
# Zope 2.12 are used for .objectIds(), .objectValues() and
# .objectItems(). In these cases, force the
LOG('Products.ERP5.Document.BusinessTemplate', WARNING,
'Cleaning corrupt BTreeFolder2 object at %r.' % (path,))
obj._initBTrees()
obj = obj._getCopy(container)
try:
container._setObject(object_id, obj)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment