[Zope3-checkins] CVS: Zope3/src/zope/app/workflow/stateful - contentworkflow.py:1.7.10.1 definition.py:1.6.10.1 instance.py:1.11.4.1

Jim Fulton jim at zope.com
Mon Sep 8 15:22:25 EDT 2003


Update of /cvs-repository/Zope3/src/zope/app/workflow/stateful
In directory cvs.zope.org:/tmp/cvs-serv20092/src/zope/app/workflow/stateful

Modified Files:
      Tag: parentgeddon-branch
	contentworkflow.py definition.py instance.py 
Log Message:
Checking in work in progress on parentgeddon-branch so Fred can help
me to get the tests passing.  Specific log entries will be provided
when we merge this into the head.


=== Zope3/src/zope/app/workflow/stateful/contentworkflow.py 1.7 => 1.7.10.1 ===
--- Zope3/src/zope/app/workflow/stateful/contentworkflow.py:1.7	Tue Jul 29 20:00:25 2003
+++ Zope3/src/zope/app/workflow/stateful/contentworkflow.py	Mon Sep  8 14:21:54 2003
@@ -22,7 +22,6 @@
 from persistence import Persistent
 from persistence.dict import PersistentDict
 from zope.component import getService, queryAdapter
-from zope.context import ContextMethod
 
 from zope.app.interfaces.event import ISubscriber
 from zope.app.interfaces.event import IObjectCreatedEvent
@@ -77,7 +76,6 @@
                     continue
                 pi_container.setObject(pd_name, pi)
 
-    notify = ContextMethod(notify)
 
 
     def subscribe(self):
@@ -87,7 +85,6 @@
         channel = self._getChannel(None)
         channel.subscribe(self, IObjectCreatedEvent)
         self.currentlySubscribed = True
-    subscribe = ContextMethod(subscribe)
 
     def unsubscribe(self):
         """See interfaces.workflows.stateful.IContentWorkflowsManager"""
@@ -96,7 +93,6 @@
         channel = self._getChannel(None)
         channel.unsubscribe(self, IObjectCreatedEvent)
         self.currentlySubscribed = False
-    unsubscribe = ContextMethod(unsubscribe)
 
     def isSubscribed(self):
         """See interfaces.workflows.stateful.IContentWorkflowsManager"""
@@ -106,7 +102,6 @@
         if channel is None:
             channel = getService(self, EventSubscription)
         return channel
-    _getChannel = ContextMethod(_getChannel)
 
     def getProcessDefinitionNamesForObject(self, object):
         """See interfaces.workflows.stateful.IContentWorkflowsManager"""


=== Zope3/src/zope/app/workflow/stateful/definition.py 1.6 => 1.6.10.1 ===
--- Zope3/src/zope/app/workflow/stateful/definition.py:1.6	Thu Jul 31 11:01:36 2003
+++ Zope3/src/zope/app/workflow/stateful/definition.py	Mon Sep  8 14:21:54 2003
@@ -21,9 +21,7 @@
 from persistence import Persistent
 from persistence.dict import PersistentDict
 
-from zope.app.context import ContextWrapper
-from zope.context import getWrapperContainer
-from zope.context import ContextMethod
+from zope.app.container.contained import Contained
 
 from zope.app.interfaces.container import IReadContainer
 
@@ -48,7 +46,7 @@
     implements(IStatefulStatesContainer)
 
 
-class Transition(Persistent):
+class Transition(Persistent, Contained):
     """Transition from one state to another."""
 
     implements(ITransition)
@@ -119,8 +117,7 @@
                            "TriggerMode for Transition.")
 
     def getProcessDefinition(self):
-        return getWrapperContainer(self).getProcessDefinition()
-    getProcessDefinition = ContextMethod(getProcessDefinition)
+        return self.__parent__.getProcessDefinition()
 
 
 class TransitionsContainer(ProcessDefinitionElementContainer):
@@ -172,7 +169,6 @@
     def getState(self, name):
         """See workflow.stateful.IStatefulProcessDefinition"""
         return self.states[name]
-    getState = ContextMethod(getState)
 
     def removeState(self, name):
         """See workflow.stateful.IStatefulProcessDefinition"""
@@ -195,7 +191,6 @@
     def getTransition(self, name):
         """See workflow.stateful.IStatefulProcessDefinition"""
         return self.transitions[name]
-    getTransition = ContextMethod(getTransition)
 
     def removeTransition(self, name):
         """See workflow.stateful.IStatefulProcessDefinition"""
@@ -208,9 +203,8 @@
     def createProcessInstance(self, definition_name):
         """See workflow.IProcessDefinition"""
         pi_obj = StatefulProcessInstance(definition_name)
-        ContextWrapper(pi_obj, self).initialize()
+        pi_obj.initialize()
         return pi_obj
-    createProcessInstance = ContextMethod(createProcessInstance)
 
 
     def __getitem__(self, key):
@@ -222,7 +216,6 @@
 
         return result
 
-    __getitem__ = ContextMethod(__getitem__)
 
     def get(self, key, default=None):
         "See Interface.Common.Mapping.IReadMapping"
@@ -235,7 +228,6 @@
 
         return default
 
-    get = ContextMethod(get)
 
     def __contains__(self, key):
         "See Interface.Common.Mapping.IReadMapping"
@@ -253,12 +245,10 @@
     def values(self):
         """See zope.app.interfaces.container.IReadContainer"""
         return map(self.get, self.keys())
-    values = ContextMethod(values)
 
     def items(self):
         """See zope.app.interfaces.container.IReadContainer"""
         return [(key, self.get(key)) for key in self.keys()]
-    items = ContextMethod(items)
 
     def __len__(self):
         """See zope.app.interfaces.container.IReadContainer"""


=== Zope3/src/zope/app/workflow/stateful/instance.py 1.11 => 1.11.4.1 ===
--- Zope3/src/zope/app/workflow/stateful/instance.py:1.11	Thu Aug 21 16:10:30 2003
+++ Zope3/src/zope/app/workflow/stateful/instance.py	Mon Sep  8 14:21:54 2003
@@ -20,7 +20,6 @@
 from persistence import Persistent
 from persistence.dict import PersistentDict
 
-from zope.app.context import ContextWrapper
 from zope.app.event import publish
 from zope.app.interfaces.workflow.stateful import AUTOMATIC
 from zope.app.interfaces.workflow.stateful import IStatefulProcessInstance
@@ -34,7 +33,7 @@
 from zope.app.traversing import getParent
 from zope.app.workflow.instance import ProcessInstance
 from zope.component import getService, getServiceManager
-from zope.context import ContextMethod, ContextProperty, getWrapperContainer
+from zope.app.container.contained import Contained
 from zope.exceptions import Unauthorized
 from zope.interface import directlyProvides, implements
 from zope.proxy import removeAllProxies
@@ -79,7 +78,7 @@
     implements(IAfterRelevantDataChangeEvent)
 
 
-class RelevantData(Persistent):
+class RelevantData(Persistent, Contained):
     """The relevant data object can store data that is important to the
     workflow and fires events when this data is changed.
 
@@ -122,7 +121,7 @@
                           key in getFields(self.__schema).keys()
 
         if is_schema_field:
-            process = getWrapperContainer(self)
+            process = self.__parent__ 
             # Send an Event before RelevantData changes
             oldvalue = getattr(self, key, None)
             publish(self, BeforeRelevantDataChangeEvent(
@@ -134,7 +133,6 @@
             # Send an Event after RelevantData has changed
             publish(self, AfterRelevantDataChangeEvent(
                 process, self.__schema, key, oldvalue, value))
-    __setattr__ = ContextMethod(__setattr__)
 
     def getChecker(self):
         return Checker(self.__checker_getattr.get,
@@ -165,10 +163,9 @@
         if self._data is None:
             return None
         # Always give out the data attribute as proxied object.
-        data = Proxy(self._data, self._data.getChecker())
-        return ContextWrapper(data, self, name="data")
-
-    data = ContextProperty(getData)
+        return Proxy(self._data, self._data.getChecker())
+        
+    data = property(getData) 
 
     def initialize(self):
         """See zope.app.interfaces.workflow.IStatefulProcessInstance"""
@@ -188,14 +185,12 @@
 
         # check for Automatic Transitions
         self._checkAndFireAuto(clean_pd)
-    initialize = ContextMethod(initialize)
 
     def getOutgoingTransitions(self):
         """See zope.app.interfaces.workflow.IStatefulProcessInstance"""
         pd = self.getProcessDefinition()
         clean_pd = removeAllProxies(pd)
         return self._outgoingTransitions(clean_pd)
-    getOutgoingTransitions = ContextMethod(getOutgoingTransitions)
 
     def fireTransition(self, id):
         """See zope.app.interfaces.workflow.IStatefulProcessInstance"""
@@ -218,13 +213,11 @@
 
         # check for automatic transitions and fire them if necessary
         self._checkAndFireAuto(clean_pd)
-    fireTransition = ContextMethod(fireTransition)
 
     def getProcessDefinition(self):
         """Get the ProcessDefinition object from WorkflowService."""
         svc =  getService(self, "Workflows")
         return svc.getProcessDefinition(self.processDefinitionName)
-    getProcessDefinition = ContextMethod(getProcessDefinition)
 
     # XXX this is not entirely tested
     def _getContext(self):
@@ -238,7 +231,7 @@
         # to a Content-Object and provide secure ***READONLY***
         # Access to it for evaluating Transition Conditions ???
 
-        #content = getWrapperContainer(self)
+        #content = self.__parent__
 
         # XXX How can i make sure that nobody modifies content
         # while the condition scripts/conditions are evaluated ????
@@ -256,7 +249,6 @@
         #ctx['content'] = content
 
         return ctx
-    _getContext = ContextMethod(_getContext)
 
 
     def _extendContext(self, transition, ctx={}):
@@ -279,7 +271,6 @@
             sm = getServiceManager(self)
             script = sm.resolve(script)
         return script(contexts)
-    _evaluateScript = ContextMethod(_evaluateScript)
 
     def _outgoingTransitions(self, clean_pd):
         sm = getSecurityManager()
@@ -318,7 +309,6 @@
                 # append transition name
                 ret.append(name)
         return ret
-    _outgoingTransitions = ContextMethod(_outgoingTransitions)
 
     def _checkAndFireAuto(self, clean_pd):
         outgoing_transitions = self.getOutgoingTransitions()
@@ -327,4 +317,3 @@
             if trans.triggerMode == AUTOMATIC:
                 self.fireTransition(name)
                 return
-    _checkAndFireAuto = ContextMethod(_checkAndFireAuto)




More information about the Zope3-Checkins mailing list