[Erp5-report] r32193 leonardo - /erp5/trunk/products/ERP5/Tool/TrashTool.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Feb 2 18:20:57 CET 2010


Author: leonardo
Date: Tue Feb  2 18:20:56 2010
New Revision: 32193

URL: http://svn.erp5.org?rev=32193&view=rev
Log:
avoid reindexing subobjects of the object being put on the trash tool on Zope 2.12

Modified:
    erp5/trunk/products/ERP5/Tool/TrashTool.py

Modified: erp5/trunk/products/ERP5/Tool/TrashTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Tool/TrashTool.py?rev=32193&r1=32192&r2=32193&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Tool/TrashTool.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Tool/TrashTool.py [utf8] Tue Feb  2 18:20:56 2010
@@ -103,7 +103,18 @@
           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




More information about the Erp5-report mailing list