[Zope3-checkins] CVS: Zope3/src/zope/app/workflow - globalimportexport.py:1.3 instance.py:1.6 service.py:1.5

Steve Alexander steve@cat-box.net
Fri, 6 Jun 2003 15:29:38 -0400


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

Modified Files:
	globalimportexport.py instance.py service.py 
Log Message:
Changed old-style __implements__ to new-style implements()

Also, fixed up some incorrect formatting.


=== Zope3/src/zope/app/workflow/globalimportexport.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/workflow/globalimportexport.py:1.2	Wed May 28 11:46:13 2003
+++ Zope3/src/zope/app/workflow/globalimportexport.py	Fri Jun  6 15:29:05 2003
@@ -22,22 +22,22 @@
 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 +58,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 +79,6 @@
         """
         self._exporters.register(interface, factory)
 
-    
 
 globalImportExport = ImportExportUtility()
 


=== Zope3/src/zope/app/workflow/instance.py 1.5 => 1.6 ===
--- Zope3/src/zope/app/workflow/instance.py:1.5	Tue Jun  3 18:46:23 2003
+++ Zope3/src/zope/app/workflow/instance.py	Fri Jun  6 15:29:05 2003
@@ -26,6 +26,7 @@
 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 ???
@@ -33,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
 
@@ -86,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)
@@ -94,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
@@ -107,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
@@ -123,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.4 => 1.5 ===
--- Zope3/src/zope/app/workflow/service.py:1.4	Tue Jun  3 18:46:23 2003
+++ Zope3/src/zope/app/workflow/service.py	Fri Jun  6 15:29:05 2003
@@ -38,6 +38,7 @@
 from zope.app.interfaces.workflow import IProcessDefinitionConfiguration
 from zope.app.interfaces.workflow import IProcessDefinition
 from zope.app.interfaces.workflow import IWorkflowService
+from zope.interface import implements
 
 
 class ILocalWorkflowService(IWorkflowService, INameComponentConfigurable):
@@ -49,8 +50,7 @@
 
     __doc__ = IWorkflowService.__doc__
 
-    __implements__ = ILocalWorkflowService, ISimpleService 
-                     
+    implements(ILocalWorkflowService, ISimpleService)
 
     ############################################################
     # Implementation methods for interface
@@ -105,14 +105,11 @@
     ############################################################
 
 
-
-
 class ProcessDefinitionConfiguration(NamedComponentConfiguration):
 
     __doc__ = IProcessDefinitionConfiguration.__doc__
 
-    __implements__ = (IProcessDefinitionConfiguration,
-                      NamedComponentConfiguration.__implements__)
+    implements(IProcessDefinitionConfiguration)
 
     status = ConfigurationStatusProperty('Workflows')
 
@@ -143,5 +140,5 @@
         pd = configuration.getComponent()
         adapter = getAdapter(pd, IUseConfiguration)
         adapter.removeUsage(getPath(configuration))
-        super(ProcessDefinitionConfiguration, self).beforeDeleteHook(configuration,
-                                                                     container)
+        super(ProcessDefinitionConfiguration, self).beforeDeleteHook(
+            configuration, container)