[Zope3-checkins] SVN: Zope3/branches/jack-e_interfacebased_workflow/src/zope/app/workflow/stateful/instance.py Cleanup a bit

Julien Anguenot ja at nuxeo.com
Tue Oct 12 06:29:23 EDT 2004


Log message for revision 27992:
  Cleanup a bit


Changed:
  U   Zope3/branches/jack-e_interfacebased_workflow/src/zope/app/workflow/stateful/instance.py


-=-
Modified: Zope3/branches/jack-e_interfacebased_workflow/src/zope/app/workflow/stateful/instance.py
===================================================================
--- Zope3/branches/jack-e_interfacebased_workflow/src/zope/app/workflow/stateful/instance.py	2004-10-12 10:28:01 UTC (rev 27991)
+++ Zope3/branches/jack-e_interfacebased_workflow/src/zope/app/workflow/stateful/instance.py	2004-10-12 10:29:22 UTC (rev 27992)
@@ -45,6 +45,8 @@
 from zope.tales.engine import Engine
 
 
+##############################################################
+
 class TransitionEvent(object):
     """A simple implementation of the transition event."""
     implements(ITransitionEvent)
@@ -59,12 +61,8 @@
 class AfterTransitionEvent(TransitionEvent):
     implements(IAfterTransitionEvent)
 
+#############################################################
 
-
-
-
-
-
 class StateChangeInfo(object):
     """Immutable StateChangeInfo."""
 
@@ -76,9 +74,8 @@
 
     new_state = property(lambda self: self.__new_state)
 
+#############################################################
 
-
-
 class StatefulPIAdapter(PIAdapter):
     """Stateful Workflow ProcessInstance Adapter."""
 
@@ -90,9 +87,9 @@
 
         # check for Automatic Transitions
         self._checkAndFireAuto(clean_pd)
-        
 
 
+
     def getOutgoingTransitions(self):
         """See zope.app.workflow.interfaces.IStatefulProcessInstance"""
         clean_pd = removeAllProxies(self.processDefinition)
@@ -102,12 +99,12 @@
     # XXX API change here !!!
     def fireTransition(self, trans_id, event=None):
         """See zope.app.workflow.interfaces.IStatefulProcessInstance"""
-        
+
         clean_pd = removeAllProxies(self.processDefinition)
         if not trans_id in self._outgoingTransitions(clean_pd, event):
             raise KeyError, 'Invalid Transition Id: %s' % trans_id
         transition = clean_pd.transitions[trans_id]
-        
+
         # Get the object whose status is being changed.
         obj = removeSecurityProxy(self.context)
 
@@ -116,7 +113,7 @@
 
         # XXX Jim suggests to send out ObjectStateChanging/Changed Events instead
         # of Before/AfterTransition. Need to check the side effects (Phase2)
-        
+
         # change status
         # XXX change self.context to implement the new interface
         # and remove the old state's interface
@@ -132,8 +129,6 @@
         # check for automatic transitions and fire them if necessary
         self._checkAndFireAuto(clean_pd)
 
-
-
     def _getContext(self, context={}):
         # data should be readonly for condition-evaluation
         context['principal'] = None
@@ -220,7 +215,6 @@
                 self.fireTransition(name)
                 return
 
-
 def initializeStatefulProcessFor(obj, pd_name):
     """provide a component and a processdefinition_name and
        to give that component behaviour.
@@ -232,12 +226,12 @@
     # named Adapters providing (IProcessDefinition, [name])
     # for (ISomeStatefulProcess, ISomeContentType)
     obj.__processdefinition_name__ = pd_name
-    
+
     pd = zapi.getUtility(IProcessDefinition, pd_name)
     clean_pd = removeAllProxies(pd)
-    
+
     # XXX Jim suggests to send out ObjectStateChanging/Changed Events here (Phase2)
-    
+
     # XXX Set Initial Interface to self.context here !!!
     directlyProvides(obj, pd.states[pd.getInitialStateName()].targetInterface)
 



More information about the Zope3-Checkins mailing list