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

Stephan Richter srichter at cosmos.phy.tufts.edu
Thu Aug 21 17:11:00 EDT 2003


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

Modified Files:
	contentworkflow.py instance.py 
Log Message:
Fixed Workflow code to comply with API changes.

Also fixed the situation in which no relevant data interface was specified.


=== Zope3/src/zope/app/browser/workflow/stateful/contentworkflow.py 1.6 => 1.7 ===
--- Zope3/src/zope/app/browser/workflow/stateful/contentworkflow.py:1.6	Wed Aug 13 17:28:28 2003
+++ Zope3/src/zope/app/browser/workflow/stateful/contentworkflow.py	Thu Aug 21 16:10:30 2003
@@ -64,7 +64,7 @@
         wf = getService(self.context, Workflows)
         for name in wf.getProcessDefinitionNames():
             ifaces = self.context.getInterfacesForProcessName(name)
-            ifaces = map(interfaceToName, ifaces)
+            ifaces = map(lambda i: interfaceToName(self.context, i), ifaces)
             if ifaces:
                 mapping.append({'name': name, 'ifaces': ifaces})
         return mapping
@@ -74,7 +74,8 @@
         # Nothing bad here; we just read the registry data
         registry = trustedRemoveSecurityProxy(self.context)._registry
         for iface, names in registry.items(): 
-            mapping.append({'iface': interfaceToName(iface), 'names': names})
+            mapping.append({'iface': interfaceToName(self.context, iface),
+                            'names': names})
         return mapping
 
     def update(self):


=== Zope3/src/zope/app/browser/workflow/stateful/instance.py 1.8 => 1.9 ===
--- Zope3/src/zope/app/browser/workflow/stateful/instance.py:1.8	Sun Aug 17 02:06:06 2003
+++ Zope3/src/zope/app/browser/workflow/stateful/instance.py	Thu Aug 21 16:10:30 2003
@@ -24,6 +24,7 @@
 from zope.app.services.servicenames import Workflows
 from zope.component import getAdapter, getService
 from zope.context import getWrapperData
+from zope.interface import Interface
 from zope.proxy import removeAllProxies
 from zope.publisher.browser import BrowserView
 from zope.security.proxy import trustedRemoveSecurityProxy
@@ -39,6 +40,8 @@
     def __init__(self, context, request):
         super(ManagementView, self).__init__(context, request)
         workflow = self._getSelWorkflow() 
+        if workflow.data is None:
+            return
         schema = workflow.data.getSchema()
         for name, field in getFields(schema).items():
             # setUpWidget() does not mutate the field, so it is ok.
@@ -126,6 +129,8 @@
 
 
     def widgets(self):
+        if self._getSelWorkflow().data is None:
+            return []
         schema = self._getSelWorkflow().data.getSchema()
         return [getattr(self, name+'_widget')
                 for name in getFields(schema).keys()]
@@ -133,9 +138,9 @@
     
     def update(self):
         status = ''
+        workflow = self._getSelWorkflow() 
 
-        if Update in self.request:
-            workflow = self._getSelWorkflow() 
+        if Update in self.request and workflow.data is not None:
             schema = trustedRemoveSecurityProxy(workflow.data.getSchema())
             changed = applyWidgetsChanges(
                 self, workflow.data, schema, names=getFields(schema).keys(),




More information about the Zope3-Checkins mailing list