[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Workflow - IWorkflowEvents.py:1.1.2.5 WorkflowEvents.py:1.1.2.5

Tres Seaver tseaver@zope.com
Tue, 5 Mar 2002 06:23:22 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/Workflow
In directory cvs.zope.org:/tmp/cvs-serv2508

Modified Files:
      Tag: Zope-3x-branch
	IWorkflowEvents.py WorkflowEvents.py 
Log Message:
 - Refactor duplication (tests, implementation) into base classes.

=== Zope3/lib/python/Zope/App/Workflow/IWorkflowEvents.py 1.1.2.4 => 1.1.2.5 ===
         """
 
-class IWorkflowActionCompletedEvent(IWorkflowEvent):
+class IWorkflowActionAssignedEvent( IWorkflowEvent ):
     """
-    Note the completion of a WorkItem or a transition.
+        Note the assignment of a workflow-aware action.
     """
     def getAction():
         """
-        Return the action that was just completed.
         """
 
-class IWorkflowActionExceptionEvent(IWorkflowEvent):
+
+class IWorkflowActionBegunEvent( IWorkflowEvent ):
     """
-    Note that the execution of an action had an exceptional termination.
+        Note the beginning of a workflow-aware action.
     """
     def getAction():
         """
-        Return the action that had an exception.
+        """
+
+class IWorkflowActionCompletedEvent(IWorkflowEvent):
+    """
+    Note the completion of a WorkItem or a transition.
+    """
+    def getAction():
+        """
+        Return the action that was just completed.
         """
 
 class IWorkflowActionSuspendedEvent( IWorkflowEvent ):
@@ -48,19 +56,19 @@
         """
         """
 
-class IWorkflowActionAssignedEvent( IWorkflowEvent ):
+class IWorkflowActionTerminatedEvent( IWorkflowEvent ):
     """
-        Note the assignment of a workflow-aware action.
+        Note the suspension of a workflow-aware action.
     """
     def getAction():
         """
         """
 
-
-class IWorkflowActionBegunEvent( IWorkflowEvent ):
+class IWorkflowActionExceptionEvent(IWorkflowEvent):
     """
-        Note the beginning of a workflow-aware action.
+    Note that the execution of an action had an exceptional termination.
     """
     def getAction():
         """
+        Return the action that had an exception.
         """


=== Zope3/lib/python/Zope/App/Workflow/WorkflowEvents.py 1.1.2.4 => 1.1.2.5 ===
-from IWorkflowEvents import IWorkflowActionCompletedEvent
-from IWorkflowEvents import IWorkflowActionExceptionEvent
-from IWorkflowEvents import IWorkflowActionSuspendedEvent
 from IWorkflowEvents import IWorkflowActionAssignedEvent
 from IWorkflowEvents import IWorkflowActionBegunEvent
+from IWorkflowEvents import IWorkflowActionCompletedEvent
+from IWorkflowEvents import IWorkflowActionSuspendedEvent
+from IWorkflowEvents import IWorkflowActionTerminatedEvent
+from IWorkflowEvents import IWorkflowActionExceptionEvent
 
-class WorkflowActionCreatedEvent:
-
-
-    __implements__ =  IWorkflowActionCreatedEvent
 
+class WorkflowActionEvent:
+    """
+        Base class for all action-related events.
+    """
     def __init__( self, action ):
         self._action = action
 
+    def getAction(self):
+        '''See interface IWorkflowActionCreatedEvent'''
+        return self._action
+
+class WorkflowActionCreatedEvent( WorkflowActionEvent ):
+
+
+    __implements__ =  IWorkflowActionCreatedEvent
+
     ############################################################
     # Implementation methods for interface
     # Zope.App.Workflow.IWorkflowEvents.IWorkflowActionCreatedEvent
+    # getAction:  use inherited implementation
 
-    def getAction(self):
-        '''See interface IWorkflowActionCreatedEvent'''
-        return self._action
     #
     ############################################################
 
 
-class WorkflowActionCompletedEvent:
+class WorkflowActionAssignedEvent( WorkflowActionEvent ):
 
-    __implements__ =  IWorkflowActionCompletedEvent
+
+    __implements__ =  IWorkflowActionAssignedEvent
 
     ############################################################
     # Implementation methods for interface
-    # Zope.App.Workflow.IWorkflowEvents.IWorkflowActionCompletedEvent
+    # Zope.App.Workflow.IWorkflowActionAssignedEvent
+    # getAction:  use inherited implementation
 
-    def getAction(self):
-        '''See interface IWorkflowActionCompletedEvent'''
     #
     ############################################################
 
 
-class WorkflowActionExceptionEvent:
+class WorkflowActionBegunEvent( WorkflowActionEvent ):
 
-    __implements__ =  IWorkflowActionExceptionEvent
+
+    __implements__ =  IWorkflowActionBegunEvent
 
     ############################################################
     # Implementation methods for interface
-    # Zope.App.Workflow.IWorkflowEvents.IWorkflowActionExceptionEvent
+    # Zope.App.Workflow.IWorkflowActionBegunEvent
+    # getAction:  use inherited implementation
 
-    def getAction(self):
-        '''See interface IWorkflowActionExceptionEvent'''
     #
     ############################################################
 
 
-class WorkflowActionSuspendedEvent:
+class WorkflowActionCompletedEvent( WorkflowActionEvent ):
+
+    __implements__ =  IWorkflowActionCompletedEvent
+
+    ############################################################
+    # Implementation methods for interface
+    # Zope.App.Workflow.IWorkflowEvents.IWorkflowActionCompletedEvent
+    # getAction:  use inherited implementation
+
+    #
+    ############################################################
+
+
+class WorkflowActionSuspendedEvent( WorkflowActionEvent ):
 
     __implements__ =  IWorkflowActionSuspendedEvent
 
@@ -60,37 +81,32 @@
     # Implementation methods for interface
     # Zope.App.Workflow.IWorkflowEvents.IWorkflowActionSuspendedEvent
 
-    def getAction(self):
-        '''See interface IWorkflowActionSuspendedEvent'''
+    #getAction -- use inherited
     #
     ############################################################
 
 
-class WorkflowActionAssignedEvent:
+class WorkflowActionTerminatedEvent( WorkflowActionEvent ):
 
-
-    __implements__ =  IWorkflowActionAssignedEvent
+    __implements__ =  IWorkflowActionTerminatedEvent
 
     ############################################################
     # Implementation methods for interface
-    # Zope.App.Workflow.IWorkflowActionAssignedEvent
+    # Zope.App.Workflow.IWorkflowEvents.IWorkflowActionTerminatedEvent
+    # getAction:  use inherited implementation
 
-    def getAction(self):
-        '''See interface IWorkflowActionAssignedEvent'''
     #
     ############################################################
 
 
-class WorkflowActionBegunEvent:
+class WorkflowActionExceptionEvent( WorkflowActionEvent ):
 
-
-    __implements__ =  IWorkflowActionBegunEvent
+    __implements__ =  IWorkflowActionExceptionEvent
 
     ############################################################
     # Implementation methods for interface
-    # Zope.App.Workflow.IWorkflowActionBegunEvent
+    # Zope.App.Workflow.IWorkflowEvents.IWorkflowActionExceptionEvent
+    # getAction:  use inherited implementation
 
-    def getAction(self):
-        '''See interface IWorkflowActionBegunEvent'''
     #
     ############################################################