[Zope3-checkins] CVS: Zope3/src/zope/app/workflow/browser/stateful - instance.py:1.9 contentworkflow.py:1.7

Stephan Richter srichter at cosmos.phy.tufts.edu
Thu Apr 15 18:11:11 EDT 2004


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

Modified Files:
	instance.py contentworkflow.py 
Log Message:


Got rid of workflow service.




=== Zope3/src/zope/app/workflow/browser/stateful/instance.py 1.8 => 1.9 ===
--- Zope3/src/zope/app/workflow/browser/stateful/instance.py:1.8	Fri Mar 19 15:26:38 2004
+++ Zope3/src/zope/app/workflow/browser/stateful/instance.py	Thu Apr 15 18:11:10 2004
@@ -15,25 +15,23 @@
  
 $Id$
 """
-from zope.component import getService
 from zope.proxy import removeAllProxies
-from zope.app.publisher.browser import BrowserView
 from zope.security.proxy import trustedRemoveSecurityProxy
 from zope.schema import getFields
 
+from zope.app import zapi
 from zope.app.form.browser.submit import Update
 from zope.app.form.utility import setUpWidget, applyWidgetsChanges
 from zope.app.form.interfaces import IInputWidget
 from zope.app.i18n import ZopeMessageIDFactory as _
 from zope.app.dublincore.interfaces import IZopeDublinCore
-from zope.app.servicenames import Workflows
+from zope.app.publisher.browser import BrowserView
+from zope.app.servicenames import Utilities
 
+from zope.app.workflow.interfaces import IProcessDefinition
 from zope.app.workflow.interfaces import IProcessInstanceContainer
 from zope.app.workflow.interfaces import IProcessInstanceContainerAdaptable
 
-__metaclass__ = type
-
- 
 class ManagementView(BrowserView):
 
     __used_for__ = IProcessInstanceContainerAdaptable
@@ -124,8 +122,9 @@
 
 
     def _getProcessDefinition(self, processInstance):
-        ws = getService(self.context, Workflows)
-        return ws.getProcessDefinition(processInstance.processDefinitionName)
+        utils = zapi.getService(self.context, Utilities)
+        return utils.getUtility(IProcessDefinition,
+                                processInstance.processDefinitionName)
 
 
     def widgets(self):


=== Zope3/src/zope/app/workflow/browser/stateful/contentworkflow.py 1.6 => 1.7 ===
--- Zope3/src/zope/app/workflow/browser/stateful/contentworkflow.py:1.6	Fri Mar 19 15:26:38 2004
+++ Zope3/src/zope/app/workflow/browser/stateful/contentworkflow.py	Thu Apr 15 18:11:10 2004
@@ -15,23 +15,21 @@
  
 $Id$
 """
+from zope.app import zapi
 from zope.app.introspector import interfaceToName
 from zope.app.component.interface import nameToInterface
 from zope.app.component.interfacefield import InterfaceField
 from zope.app.i18n import ZopeMessageIDFactory as _
 from zope.app.form.utility import setUpWidgets
-from zope.app.servicenames import Workflows
+from zope.app.servicenames import Utilities
 from zope.app.form.interfaces import IInputWidget
-from zope.component import getService
 from zope.interface import Interface
 from zope.app.publisher.browser import BrowserView
 from zope.schema.vocabulary import VocabularyListField
 from zope.security.proxy import trustedRemoveSecurityProxy 
+from zope.app.workflow.interfaces import IProcessDefinition
 
-__metaclass__ = type
- 
-
-class ContentWorkflowsManagerView:
+class ContentWorkflowsManagerView(object):
  
     def getName(self):
         return """I'm a ContentWorkflows Utility"""
@@ -63,8 +61,9 @@
 
     def getProcessInterfacesMapping(self):
         mapping = []
-        wf = getService(self.context, Workflows)
-        for name in wf.getProcessDefinitionNames():
+        utils = zapi.getService(self.context, Utilities)
+        for name in [name for name, util in utils.getUtilitiesFor(
+                                                       IProcessDefinition)]:
             ifaces = self.context.getInterfacesForProcessName(name)
             ifaces = map(lambda i: interfaceToName(self.context, i), ifaces)
             if ifaces:




More information about the Zope3-Checkins mailing list