[Checkins] SVN: CMF/branches/2.1/ Fix for #490: use new status when emiting AfterTransitionEvents

Martijn Pieters mj at zopatista.com
Fri Aug 10 16:19:46 EDT 2007


Log message for revision 78745:
  Fix for #490: use new status when emiting AfterTransitionEvents

Changed:
  U   CMF/branches/2.1/CHANGES.txt
  U   CMF/branches/2.1/DCWorkflow/DCWorkflow.py
  U   CMF/branches/2.1/DCWorkflow/interfaces.py
  U   CMF/branches/2.1/DCWorkflow/tests/test_DCWorkflow.py

-=-
Modified: CMF/branches/2.1/CHANGES.txt
===================================================================
--- CMF/branches/2.1/CHANGES.txt	2007-08-10 15:52:47 UTC (rev 78744)
+++ CMF/branches/2.1/CHANGES.txt	2007-08-10 20:19:46 UTC (rev 78745)
@@ -1,3 +1,11 @@
+CMF 2.1.1 (unreleased)
+
+  Bug Fixes
+
+    - AfterTransitionEvent now passes along the new status of the object, just
+      as StateChangeInfo passes on the new status to after-transition scripts.
+      (http://www.zope.org/Collectors/CMF/490)
+
 CMF 2.1.0 (2007/08/08)
 
   New Features

Modified: CMF/branches/2.1/DCWorkflow/DCWorkflow.py
===================================================================
--- CMF/branches/2.1/DCWorkflow/DCWorkflow.py	2007-08-10 15:52:47 UTC (rev 78744)
+++ CMF/branches/2.1/DCWorkflow/DCWorkflow.py	2007-08-10 20:19:46 UTC (rev 78745)
@@ -537,7 +537,7 @@
             script(sci)  # May throw an exception.
 
         # Fire "after" event
-        notify(AfterTransitionEvent(ob, self, old_sdef, new_sdef, tdef, former_status, kwargs))
+        notify(AfterTransitionEvent(ob, self, old_sdef, new_sdef, tdef, status, kwargs))
 
         # Return the new state object.
         if moved_exc is not None:

Modified: CMF/branches/2.1/DCWorkflow/interfaces.py
===================================================================
--- CMF/branches/2.1/DCWorkflow/interfaces.py	2007-08-10 15:52:47 UTC (rev 78744)
+++ CMF/branches/2.1/DCWorkflow/interfaces.py	2007-08-10 20:19:46 UTC (rev 78745)
@@ -33,7 +33,7 @@
     new_state = Attribute(u"The state definition of the workflow state before after transition")
     transition = Attribute(u"The transition definition taking place. "
                             "May be None if this is the 'transition' to the initial state.")                                   
-    status = Attribute(u"The history/status dict of the object before the transition.")
+    status = Attribute(u"The status dict of the object.")
     kwargs = Attribute(u"Any keyword arguments passed to doActionFor() when the transition was invoked")
     
 class IBeforeTransitionEvent(ITransitionEvent):

Modified: CMF/branches/2.1/DCWorkflow/tests/test_DCWorkflow.py
===================================================================
--- CMF/branches/2.1/DCWorkflow/tests/test_DCWorkflow.py	2007-08-10 15:52:47 UTC (rev 78744)
+++ CMF/branches/2.1/DCWorkflow/tests/test_DCWorkflow.py	2007-08-10 20:19:46 UTC (rev 78745)
@@ -137,7 +137,7 @@
         self.assertEquals('private', evt.old_state.id)
         self.assertEquals('private', evt.new_state.id)
         self.assertEquals(None, evt.transition)
-        self.assertEquals({}, evt.status)
+        self.assertEquals({'state': 'private', 'comments': ''}, evt.status)
         self.assertEquals(None, evt.kwargs)
 
         evt = events[2]
@@ -155,7 +155,7 @@
         self.assertEquals('private', evt.old_state.id)
         self.assertEquals('published', evt.new_state.id)
         self.assertEquals('publish', evt.transition.id)
-        self.assertEquals({'state': 'private', 'comments': ''}, evt.status)
+        self.assertEquals({'state': 'published', 'comments': 'foo'}, evt.status)
         self.assertEquals({'test' : 'bar', 'comment' : 'foo'}, evt.kwargs)
 
     def test_checkTransitionGuard(self):



More information about the Checkins mailing list