[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/workflow/stateful/definition.py - Added publishing of object modification after adding

Eckart Hertzler eckart at hertzler.de
Thu May 13 12:05:57 EDT 2004


Log message for revision 24628:
- Added publishing of object modification after adding 
  the states and transitions container.

  Without publishing, the states and transitions container 
  could not be accessed with a browser.

- Ordered the import statements



-=-
Modified: Zope3/trunk/src/zope/app/workflow/stateful/definition.py
===================================================================
--- Zope3/trunk/src/zope/app/workflow/stateful/definition.py	2004-05-13 16:02:08 UTC (rev 24627)
+++ Zope3/trunk/src/zope/app/workflow/stateful/definition.py	2004-05-13 16:05:56 UTC (rev 24628)
@@ -17,17 +17,19 @@
 """
 from persistent import Persistent
 from persistent.dict import PersistentDict
+
 from zope.interface import implements
 
 from zope.app.container.interfaces import IReadContainer
+from zope.app.container.contained import Contained, containedEvent
+from zope.app.event import publish
+from zope.app.event.objectevent import ObjectEvent, modified
+from zope.app.workflow.definition import ProcessDefinition
+from zope.app.workflow.definition import ProcessDefinitionElementContainer
 from zope.app.workflow.stateful.interfaces import IStatefulProcessDefinition
 from zope.app.workflow.stateful.interfaces import IState, ITransition, INITIAL
 from zope.app.workflow.stateful.interfaces import IStatefulStatesContainer
 from zope.app.workflow.stateful.interfaces import IStatefulTransitionsContainer
-
-from zope.app.container.contained import Contained
-from zope.app.workflow.definition import ProcessDefinition
-from zope.app.workflow.definition import ProcessDefinitionElementContainer
 from zope.app.workflow.stateful.instance import StatefulProcessInstance
 
 
@@ -132,11 +134,19 @@
         self.__states[self.getInitialStateName()] = initial
         self.__transitions = TransitionsContainer()
         self.__schema = None
+        self._publishModified('transitions', self.__transitions)
+        self._publishModified('states', self.__states)
         # See workflow.stateful.IStatefulProcessDefinition
         self.schemaPermissions = PersistentDict()
 
     _clear = clear = __init__
 
+    def _publishModified(self, name, object):
+        object, event = containedEvent(object, self, name)
+        if event:
+            publish(self, event)
+            modified(self)
+
     def getRelevantDataSchema(self):
         return self.__schema
 




More information about the Zope3-Checkins mailing list