[CMF-checkins] CVS: CMF - WorkflowCore.py:1.7 WorkflowTool.py:1.12

shane@digicool.com shane@digicool.com
Tue, 12 Jun 2001 12:44:04 -0400 (EDT)


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

Modified Files:
	WorkflowCore.py WorkflowTool.py 
Log Message:
- Renamed "NoReindex" to "ObjectDeleted".

- Added a way to pass the result of a workflow operation using the
  ObjectDeleted and ObjectMoved exceptions.



--- Updated File WorkflowCore.py in package CMF --
--- WorkflowCore.py	2001/06/12 16:17:24	1.6
+++ WorkflowCore.py	2001/06/12 16:44:03	1.7
@@ -99,20 +99,29 @@
     '''
 
 
-class NoReindex (Exception):
+class ObjectDeleted (Exception):
     '''
-    Raised to tell the workflow tool not to reindex the object.
+    Raised to tell the workflow tool that the object has been deleted.
     Swallowed by the workflow tool.
     '''
+    def __init__(self, result=None):
+        self._r = result
 
+    def getResult(self):
+        return self._r
 
+
 class ObjectMoved (Exception):
     '''
     Raised to tell the workflow tool that the object has moved.
     Swallowed by the workflow tool.
     '''
-    def __init__(self, ob):
-        self._ob = ob  # Includes acquisition wrappers.
+    def __init__(self, new_ob, result=None):
+        self._ob = new_ob  # Includes acquisition wrappers.
+        self._r = result
+
+    def getResult(self):
+        return self._r
 
     def getNewObject(self):
         return self._ob
@@ -140,8 +149,8 @@
             # No workflow tool found.
             try:
                 res = apply(self._m, (instance,) + args, kw)
-            except NoReindex:
-                pass
+            except NoReindex, ex:
+                res = ex.getResult()
             else:
                 catalog = getToolByName(instance, 'portal_catalog', None)
                 if catalog is not None:

--- Updated File WorkflowTool.py in package CMF --
--- WorkflowTool.py	2001/06/12 16:31:18	1.11
+++ WorkflowTool.py	2001/06/12 16:44:03	1.12
@@ -95,7 +95,7 @@
 from Globals import InitializeClass, PersistentMapping, DTMLFile
 from AccessControl import ClassSecurityInfo
 from Acquisition import aq_base, aq_inner, aq_parent
-from WorkflowCore import WorkflowException, NoReindex, ObjectMoved
+from WorkflowCore import WorkflowException, ObjectDeleted, ObjectMoved
 import CMFCorePermissions
 from string import join, split, replace, strip
 
@@ -425,9 +425,11 @@
             w.notifyBefore(ob, action)
         try:
             res = apply(func, args, kw)
-        except NoReindex:
+        except ObjectDeleted, ex:
+            res = ex.getResult()
             reindex = 0
         except ObjectMoved, ex:
+            res = ex.getResult()
             ob = ex.getNewObject()
         except:
             exc = sys.exc_info()