Commit 5bec2ec8 authored by Jérome Perrin's avatar Jérome Perrin

BusinessTemplate: prevent a wrong "Cleaning corrupted BTreeFolder2" log

This log happens a lot, for example for property sheets, but there's
nothing corrupted, it's just that we export the objects with their empty
_mt_index
parent f12ff193
...@@ -1408,11 +1408,11 @@ class ObjectTemplateItem(BaseTemplateItem): ...@@ -1408,11 +1408,11 @@ class ObjectTemplateItem(BaseTemplateItem):
groups[path] = deepcopy(obj.groups) groups[path] = deepcopy(obj.groups)
# copy the object # copy the object
if (getattr(aq_base(obj), '_mt_index', None) is not None and if (getattr(aq_base(obj), '_mt_index', None) is not None and
obj._count() == 0): obj._count() != len(obj._mt_index.keys())):
# some btrees were exported in a corrupted state. They're empty but # Some btrees were exported in a corrupted state.
# their metadata-index (._mt_index) contains entries which in # Their meta_type-index (._mt_index) contains entries which in
# Zope 2.12 are used for .objectIds(), .objectValues() and # Zope 2.12 are used for .objectIds(), .objectValues() and
# .objectItems(). In these cases, force the # .objectItems(). In these cases, recreate index.
LOG('Products.ERP5.Document.BusinessTemplate', WARNING, LOG('Products.ERP5.Document.BusinessTemplate', WARNING,
'Cleaning corrupted BTreeFolder2 object at %r.' % (path,)) 'Cleaning corrupted BTreeFolder2 object at %r.' % (path,))
obj._initBTrees() obj._initBTrees()
......
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