avoid reindexing subobjects of the object being put on the trash tool on Zope 2.12

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32193 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d763bb37
......@@ -103,7 +103,18 @@ class TrashTool(BaseTool):
backup = connection.importFile(copy)
try:
backup.isIndexable = ConstantGetter('isIndexable', value=False)
backup_object_container._setObject(object_id, backup)
try:
# the isIndexable setting above avoids the recursion of
# manage_afterAdd on
# Products.ERP5Type.CopySupport.CopySupport.manage_afterAdd()
# but not on event subscribers, so we need to suppress_events,
# otherwise subobjects will be reindexed
backup_object_container._setObject(object_id, backup,
suppress_events=True)
except TypeError:
# BACK: On Zope 2.8. _setObject does not accept "suppress_events"
# remove when we drop support
backup_object_container._setObject(object_id, backup)
except AttributeError:
# XXX we can go here due to formulator because attribute field_added
# doesn't not exists on parent if it is a Trash Folder and not a Form
......
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