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

Florent Guillaume fg@nuxeo.com
Mon, 15 Jul 2002 18:05:07 -0400


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

Modified Files:
      Tag: CMF-1_3-branch
	CMFCatalogAware.py 
Log Message:
Merged changes from HEAD.

Added a notifyWorkflowCreated method to CMFCatalogAware that the
TypesTool can use instead of directly calling the WorkflowTool.

Now that the WorkflowTool manages its own reindexing, don't reindex
after calling WorkflowTool.notifyCreated.


=== CMF/CMFCore/CMFCatalogAware.py 1.7 => 1.7.4.1 ===
 
     def manage_afterAdd(self, item, container):
         """
-            Add self to the workflow and catalog.
+            Add self to the catalog.
         """
         #
         #   Are we being added (or moved)?
@@ -70,12 +70,7 @@
         """
             Add self to workflow, as we have just been cloned.
         """
-        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()
+        self.notifyWorkflowCreated()
         #
         #   Now let our "aspects" know we have been cloned.
         #   For instance, talkbacks.
@@ -84,7 +79,6 @@
             if hasattr(aq_base(subitem), 'manage_afterClone'):
                 subitem.manage_afterClone(item)
 
-
     def manage_beforeDelete(self, item, container):
         """
             Remove self from the catalog.
@@ -103,6 +97,15 @@
                 # name "manage_beforeDelete"
                 if hasattr(aq_base(subitem), 'manage_beforeDelete'):
                     subitem.manage_beforeDelete(item, container)
+
+    security.declarePrivate('notifyWorkflowCreated')
+    def notifyWorkflowCreated(self):
+        """
+            Notify the workflow that self was just created.
+        """
+        wftool = getToolByName(self, 'portal_workflow', None)
+        if wftool is not None:
+            wftool.notifyCreated(self)
 
 
 Globals.InitializeClass(CMFCatalogAware)