[Zope3-checkins] CVS: Zope3/src/zope/app/workflow - configure.zcml:1.1.4.1 definition.py:1.1.4.1 globalimportexport.py:1.1.4.1 instance.py:1.1.4.1 service.py:1.1.4.1

Grégoire Weber zope@i-con.ch
Sun, 22 Jun 2003 10:24:06 -0400


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

Modified Files:
      Tag: cw-mail-branch
	configure.zcml definition.py globalimportexport.py instance.py 
	service.py 
Log Message:
Synced up with HEAD

=== Zope3/src/zope/app/workflow/configure.zcml 1.1 => 1.1.4.1 ===
--- Zope3/src/zope/app/workflow/configure.zcml:1.1	Thu May  8 13:27:18 2003
+++ Zope3/src/zope/app/workflow/configure.zcml	Sun Jun 22 10:23:34 2003
@@ -28,8 +28,8 @@
   <require
       permission="zope.View"
       interface="zope.app.interfaces.workflow.IWorkflowService"
-        attributes="queryConfigurations queryConfigurationsFor
-                    listConfigurationNames" />
+        attributes="queryRegistrations queryRegistrationsFor
+                    listRegistrationNames" />
       />
   <implements 
      interface="zope.app.interfaces.annotation.IAttributeAnnotatable" 
@@ -63,17 +63,17 @@
 </content>
 
 
-<!-- Process Definition Configuration -->
+<!-- Process Definition Registration -->
 
-<content class="zope.app.workflow.service.ProcessDefinitionConfiguration">
+<content class="zope.app.workflow.service.ProcessDefinitionRegistration">
   <factory
-      id="ProcessDefinitionConfiguration"
+      id="ProcessDefinitionRegistration"
       permission="zope.ManageServices"
       />
   <require
       permission="zope.ManageServices"
-      interface="zope.app.interfaces.workflow.IProcessDefinitionConfiguration"
-      set_schema="zope.app.interfaces.workflow.IProcessDefinitionConfiguration"
+      interface="zope.app.interfaces.workflow.IProcessDefinitionRegistration"
+      set_schema="zope.app.interfaces.workflow.IProcessDefinitionRegistration"
       />
   <require
       permission="zope.ManageServices"


=== Zope3/src/zope/app/workflow/definition.py 1.1 => 1.1.4.1 ===
--- Zope3/src/zope/app/workflow/definition.py:1.1	Thu May  8 13:27:18 2003
+++ Zope3/src/zope/app/workflow/definition.py	Sun Jun 22 10:23:34 2003
@@ -20,16 +20,16 @@
 from types import StringTypes
 from persistence import Persistent
 from persistence.dict import PersistentDict
-from zope.proxy.context import ContextAware, getWrapperContainer
+from zope.context import ContextMethod, getWrapperContainer
 from zope.app.interfaces.workflow \
      import IProcessDefinition, IProcessDefinitionElementContainer
-
+from zope.interface import implements
 
 class ProcessDefinition(Persistent):
 
     __doc__ = IProcessDefinition.__doc__
-    
-    __implements__ = IProcessDefinition
+
+    implements(IProcessDefinition)
 
     name = None
 
@@ -47,11 +47,11 @@
 
 
 
-class ProcessDefinitionElementContainer(ContextAware, Persistent):
+class ProcessDefinitionElementContainer(Persistent):
     """ See IProcessDefinitionElementContainer.
     """
 
-    __implements__ = IProcessDefinitionElementContainer
+    implements(IProcessDefinitionElementContainer)
 
     def __init__(self):
         super(ProcessDefinitionElementContainer, self).__init__()
@@ -60,36 +60,36 @@
     def keys(self):
         '''See interface IProcessDefinitionElementContainer'''
         return self.__data.keys()
- 
+
     def __iter__(self):
         return iter(self.__data.keys())
- 
+
     def __getitem__(self, key):
         '''See interface IProcessDefinitionElementContainer'''
         return self.__data[key]
- 
+
     def get(self, key, default=None):
         '''See interface IProcessDefinitionElementContainer'''
         return self.__data.get(key, default)
- 
+
     def values(self):
         '''See interface IProcessDefinitionElementContainer'''
         return self.__data.values()
- 
+
     def __len__(self):
         '''See interface IProcessDefinitionElementContainer'''
         return len(self.__data)
- 
+
     def items(self):
         '''See interface IProcessDefinitionElementContainer'''
         return self.__data.items()
- 
+
     def __contains__(self, key):
         '''See interface IProcessDefinitionElementContainer'''
         return self.__data.has_key(key)
- 
+
     has_key = __contains__
- 
+
     def setObject(self, key, object):
         '''See interface IProcessDefinitionElementContainer'''
         bad = False
@@ -107,11 +107,11 @@
             raise ValueError("The key cannot be an empty string")
         self.__data[key] = object
         return key
-                
+
     def __delitem__(self, key):
         '''See interface IProcessDefinitionElementContainer'''
         del self.__data[key]
 
-
     def getProcessDefinition(self):
         return getWrapperContainer(self)
+    getProcessDefinition = ContextMethod(getProcessDefinition)


=== Zope3/src/zope/app/workflow/globalimportexport.py 1.1 => 1.1.4.1 ===
--- Zope3/src/zope/app/workflow/globalimportexport.py:1.1	Thu May  8 13:27:18 2003
+++ Zope3/src/zope/app/workflow/globalimportexport.py	Sun Jun 22 10:23:34 2003
@@ -18,26 +18,25 @@
 __metaclass__ = type
 
 from zope.interface.implementor import ImplementorRegistry
-from zope.interface._flatten import _flatten
-from zope.proxy.introspection import removeAllProxies
+from zope.proxy import removeAllProxies
 from zope.app.interfaces.workflow import IProcessDefinition
 from zope.app.interfaces.workflow import IGlobalProcessDefinitionImportExport
+from zope.interface import implements, providedBy
 
 from StringIO import StringIO
 
 class ImportExportUtility:
 
-    __implements__ = IGlobalProcessDefinitionImportExport
-
+    implements(IGlobalProcessDefinitionImportExport)
 
     def __init__(self):
         self._importers = ImplementorRegistry()
         self._exporters = ImplementorRegistry()
-        
+
     _clear = __init__
 
     # IProcessDefinitionImportExport
-    
+
     def importProcessDefinition(self, context, data):
         """Import a Process Definition
         """
@@ -58,8 +57,8 @@
         """Export a Process Definition
         """
         clean_pd = removeAllProxies(process_definition)
-        interfaces = filter(lambda x: x.extends(IProcessDefinition),
-                           _flatten(clean_pd.__implements__))
+        interfaces = [x for x in providedBy(clean_pd)
+                      if x.extends(IProcessDefinition)]
         for interface in interfaces:
             factory = self._exporters.get(interface)
             if factory is not None:
@@ -79,7 +78,6 @@
         """
         self._exporters.register(interface, factory)
 
-    
 
 globalImportExport = ImportExportUtility()
 


=== Zope3/src/zope/app/workflow/instance.py 1.1 => 1.1.4.1 ===
--- Zope3/src/zope/app/workflow/instance.py:1.1	Thu May  8 13:27:18 2003
+++ Zope3/src/zope/app/workflow/instance.py	Sun Jun 22 10:23:34 2003
@@ -18,15 +18,15 @@
 __metaclass__ = type
 
 from types import StringTypes
-from persistence import Persistent
 from persistence.dict import PersistentDict
-from zope.proxy.context import ContextWrapper
-from zope.proxy.introspection import removeAllProxies
+from zope.app.context import ContextWrapper
+from zope.proxy import removeAllProxies
 
 from zope.app.interfaces.annotation import IAnnotatable, IAnnotations
 from zope.app.interfaces.workflow \
      import IProcessInstance, IProcessInstanceContainer
 
+from zope.interface import implements
 from zope.component import getAdapter
 
 # XXX should an Instance be persistent by default ???
@@ -34,43 +34,33 @@
 
     __doc__ = IProcessInstance.__doc__
 
-    __implements__ =  IProcessInstance
+    implements(IProcessInstance)
 
     def __init__(self, pd_name):
         self._pd_name = pd_name
         self._status = None
-  
-    
+
     ############################################################
     # Implementation methods for interface
     # zope.app.interfaces.workflow.IProcessInstance
 
-
     processDefinitionName = property(lambda self: self._pd_name)
 
     status = property(lambda self: self._status)
 
-
     #
     ############################################################
 
-
     ## should probably have a method "getProcessDefinition"
 
 
-
-
-
-
-
-
 _marker = object()
 
 WFKey = "zope.app.worfklow.ProcessInstanceContainer"
 
 class ProcessInstanceContainerAdapter:
 
-    __implements__ = IProcessInstanceContainer
+    implements(IProcessInstanceContainer)
 
     __used_for__ = IAnnotatable
 
@@ -87,7 +77,7 @@
         "See IProcessInstanceContainer"
         value = self.wfdata[key]
         return ContextWrapper(value, self.context, name=key)
- 
+
     def get(self, key, default=None):
         "See IProcessInstanceContainer"
         value = self.wfdata.get(key, _marker)
@@ -95,12 +85,11 @@
             return ContextWrapper(value, self.context, name=key)
         else:
             return default
- 
+
     def __contains__(self, key):
         "See IProcessInstanceContainer"
         return key in self.wfdata
- 
- 
+
     def values(self):
         "See IProcessInstanceContainer"
         container = self.wfdata
@@ -108,15 +97,15 @@
         for key, value in container.items():
             result.append(ContextWrapper(value, self.context, name=key))
         return result
- 
+
     def keys(self):
         "See IProcessInstanceContainer"
         return self.wfdata.keys()
- 
+
     def __len__(self):
         "See IProcessInstanceContainer"
         return len(self.wfdata)
- 
+
     def items(self):
         "See IProcessInstanceContainer"
         container = self.wfdata
@@ -124,20 +113,19 @@
         for key, value in container.items():
             result.append((key, ContextWrapper(value, self.context, name=key)))
         return result
-    
+
     def setObject(self, key, object):
         "See IProcessInstanceContainer"
- 
+
         if not isinstance(key, StringTypes):
             raise TypeError("Item name is not a string.")
- 
+
         container = self.wfdata
         object = removeAllProxies(object)
         container[key] = object
         # publish event ??
         return key
- 
- 
+
     def __delitem__(self, key):
         "See IZopeWriteContainer"
         container = self.wfdata


=== Zope3/src/zope/app/workflow/service.py 1.1 => 1.1.4.1 ===
--- Zope3/src/zope/app/workflow/service.py:1.1	Thu May  8 13:27:18 2003
+++ Zope3/src/zope/app/workflow/service.py	Sun Jun 22 10:23:34 2003
@@ -19,37 +19,33 @@
 __metaclass__ = type
 
 from persistence import Persistent
-
-from zope.proxy.context import ContextMethod, ContextWrapper
-
-from zope.component import getAdapter
 from zope.app.component.nextservice import queryNextService
-from zope.app.interfaces.services.configuration \
-        import INameComponentConfigurable
-from zope.app.services.configuration import NameComponentConfigurable
-
-from zope.app.services.configuration import NamedComponentConfiguration
-from zope.app.services.configuration import ConfigurationStatusProperty
-from zope.app.interfaces.services.configuration import IUseConfiguration
-from zope.app.traversing import traverse, getPath
-
+from zope.app.context import ContextWrapper
+from zope.app.interfaces.services.registration import INameComponentRegistry
+from zope.app.interfaces.services.registration import IRegistered
 from zope.app.interfaces.services.service import ISimpleService
-from zope.app.interfaces.workflow import IProcessDefinitionConfiguration
 from zope.app.interfaces.workflow import IProcessDefinition
+from zope.app.interfaces.workflow import IProcessDefinitionRegistration
 from zope.app.interfaces.workflow import IWorkflowService
+from zope.app.services.registration import RegistrationStatusProperty
+from zope.app.services.registration import NameComponentRegistry
+from zope.app.services.registration import NamedComponentRegistration
+from zope.app.traversing import getPath
+from zope.component import getAdapter
+from zope.context import ContextMethod
+from zope.interface import implements
 
 
-class ILocalWorkflowService(IWorkflowService, INameComponentConfigurable):
+class ILocalWorkflowService(IWorkflowService, INameComponentRegistry):
     """A Local WorkflowService.
     """
 
 
-class WorkflowService(Persistent, NameComponentConfigurable):
+class WorkflowService(Persistent, NameComponentRegistry):
 
     __doc__ = IWorkflowService.__doc__
 
-    __implements__ = ILocalWorkflowService, ISimpleService 
-                     
+    implements(ILocalWorkflowService, ISimpleService)
 
     ############################################################
     # Implementation methods for interface
@@ -58,8 +54,8 @@
     def getProcessDefinitionNames(self):
         'See IWorkflowService'
         definition_names = {}
-        for name in self.listConfigurationNames():
-            registry = self.queryConfigurations(name)
+        for name in self.listRegistrationNames():
+            registry = self.queryRegistrations(name)
             if registry.active() is not None:
                 definition_names[name] = 0
         service = queryNextService(self, "Workflows")
@@ -104,16 +100,15 @@
     ############################################################
 
 
+class ProcessDefinitionRegistration(NamedComponentRegistration):
 
+    __doc__ = IProcessDefinitionRegistration.__doc__
 
-class ProcessDefinitionConfiguration(NamedComponentConfiguration):
-
-    __doc__ = IProcessDefinitionConfiguration.__doc__
+    implements(IProcessDefinitionRegistration)
 
-    __implements__ = (IProcessDefinitionConfiguration,
-                      NamedComponentConfiguration.__implements__)
+    serviceType = 'Workflows'
 
-    status = ConfigurationStatusProperty('Workflows')
+    status = RegistrationStatusProperty()
 
 
     def getInterface(self):
@@ -122,25 +117,25 @@
     # The following hooks are called only if we implement
     # IAddNotifiable and IDeleteNotifiable.
 
-    def afterAddHook(self, configuration, container):
+    def afterAddHook(self, registration, container):
         """Hook method will call after an object is added to container.
 
         Defined in IAddNotifiable.
         """
-        super(ProcessDefinitionConfiguration, self).afterAddHook(configuration,
+        super(ProcessDefinitionRegistration, self).afterAddHook(registration,
                                                                  container)
-        pd = configuration.getComponent()
-        adapter = getAdapter(pd, IUseConfiguration)
-        adapter.addUsage(getPath(configuration))
+        pd = registration.getComponent()
+        adapter = getAdapter(pd, IRegistered)
+        adapter.addUsage(getPath(registration))
 
 
-    def beforeDeleteHook(self, configuration, container):
+    def beforeDeleteHook(self, registration, container):
         """Hook method will call before object is removed from container.
 
         Defined in IDeleteNotifiable.
         """
-        pd = configuration.getComponent()
-        adapter = getAdapter(pd, IUseConfiguration)
-        adapter.removeUsage(getPath(configuration))
-        super(ProcessDefinitionConfiguration, self).beforeDeleteHook(configuration,
-                                                                     container)
+        pd = registration.getComponent()
+        adapter = getAdapter(pd, IRegistered)
+        adapter.removeUsage(getPath(registration))
+        super(ProcessDefinitionRegistration, self).beforeDeleteHook(
+            registration, container)