[CMF-checkins] CVS: CMF/CMFCore - CMFCatalogAware.py:1.5

Florent Guillaume fg@nuxeo.com
Sat, 29 Jun 2002 22:11:51 -0400


Update of /cvs-repository/CMF/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv13933/CMFCore

Modified Files:
	CMFCatalogAware.py 
Log Message:
Fixed handling of discussion items so that they are correctly indexed,
unindexed and reinserted into the workflows when copied or moved.

This gets rid of the ugly "ERROR(200) Catalog uncatalogObject
unsuccessfully attempted to uncatalog an object with a uid of ..."
errors when deleting an object that had discussion items and that had
been copied.


=== CMF/CMFCore/CMFCatalogAware.py 1.4 => 1.5 ===
         if aq_base(container) is not aq_base(self):
             self.indexObject()
+            #
+            #   Now let our "aspects" know we were added or moved.
+            #   For instance, talkbacks.
+            #
+            for item_id, subitem in self.objectItems():
+                if hasattr(aq_base(subitem), 'manage_afterAdd'):
+                    subitem.manage_afterAdd(item, container)
 
     def manage_afterClone(self, item):
         """
             Add self to workflow, as we have just been cloned.
         """
-        if aq_base(item) is aq_base(self):
-            wf = getToolByName(self, 'portal_workflow', None)
-            if wf is not None:
-                wf.notifyCreated(self)
-                # After a clone, the workflow may have reset
-                # its variables so the object has to be reindexed.
-                self.reindexObject()
+        wf = getToolByName(self, 'portal_workflow', None)
+        if wf is not None:
+            wf.notifyCreated(self)
+            # After a clone, the workflow may have reset
+            # its variables so the object has to be reindexed.
+            self.reindexObject()
+        #
+        #   Now let our "aspects" know we have been cloned.
+        #   For instance, talkbacks.
+        #
+        for item_id, subitem in self.objectItems():
+            if hasattr(aq_base(subitem), 'manage_afterClone'):
+                subitem.manage_afterClone(item)
+
 
     def manage_beforeDelete(self, item, container):
         """
@@ -79,6 +93,7 @@
             self.unindexObject()
             #
             #   Now let our "aspects" know we are going away.
+            #   For instance, talkbacks.
             #
             for item_id, subitem in self.objectItems():
                 # Carefully avoid implicit acquisition of the