[CMF-checkins] CVS: CMF - PortalContent.py:1.15

tseaver@digicool.com tseaver@digicool.com
Thu, 31 May 2001 18:23:38 -0400 (EDT)


Update of /cvs-repository/CMF/CMFCore
In directory korak.digicool.com:/tmp/cvs-serv22907/CMFCore

Modified Files:
	PortalContent.py 
Log Message:


 - Make sure we update the catalog when our parent is deleted / moved
   (Tracker #261).



--- Updated File PortalContent.py in package CMF --
--- PortalContent.py	2001/05/25 20:54:26	1.14
+++ PortalContent.py	2001/05/31 22:23:38	1.15
@@ -158,17 +158,35 @@
             catalog.reindexObject(self)
         
     def manage_afterAdd(self, item, container):
-        "Add self to the workflow and catalog."
-        if aq_base(item) is aq_base(self):
+        """
+            Add self to the workflow and catalog.
+        """
+        #
+        #   Are we being added (or moved)?
+        #
+        if aq_base(container) is not aq_base(self):
             wf = getToolByName(self, 'portal_workflow', None)
             if wf is not None:
                 wf.notifyCreated(self)
             self.indexObject()
 
     def manage_beforeDelete(self, item, container):
-        "Remove self from the catalog."
-        if aq_base(item) is aq_base(self):
+        """
+            Remove self from the catalog.
+        """
+        #
+        #   Are we going away?
+        #
+        if aq_base(container) is not aq_base(self):
             self.unindexObject()
+            #
+            #   Now let our "aspects" know we are going away.
+            #
+            for it, subitem in self.objectItems():
+                si_m_bD = getattr( subitem, 'manage_beforeDelete', None )
+                if si_m_bD is not None:
+                    si_m_bD( item, container )
+
 
     # Contentish interface methods
     # ----------------------------