[Zope3-checkins] CVS: Zope3/src/zope/app/workflow/stateful/browser
- instance.py:1.2
Dominik Huber
dominik.huber at projekt01.ch
Mon Apr 26 05:44:50 EDT 2004
Update of /cvs-repository/Zope3/src/zope/app/workflow/stateful/browser
In directory cvs.zope.org:/tmp/cvs-serv9701
Modified Files:
instance.py
Log Message:
Bugfix: ManagementView was broken
- workflow might be None too
=== Zope3/src/zope/app/workflow/stateful/browser/instance.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/workflow/stateful/browser/instance.py:1.1 Sat Apr 24 19:18:24 2004
+++ Zope3/src/zope/app/workflow/stateful/browser/instance.py Mon Apr 26 05:44:50 2004
@@ -38,8 +38,9 @@
def __init__(self, context, request):
super(ManagementView, self).__init__(context, request)
- workflow = self._getSelWorkflow()
- if workflow.data is None:
+ workflow = self._getSelWorkflow()
+ # XXX workflow might be None
+ if workflow is None or workflow.data is None:
return
schema = workflow.data.getSchema()
for name, field in getFields(schema).items():
@@ -47,7 +48,7 @@
field = trustedRemoveSecurityProxy(field)
setUpWidget(self, name, field, IInputWidget,
value=getattr(workflow.data, name))
-
+
def _extractContentInfo(self, item):
id, processInstance = item
info = {}
@@ -105,7 +106,7 @@
def _getTitle(self, obj):
return (IZopeDublinCore(obj).title or obj.__name___)
-
+
def _getSelWorkflow(self):
reqWorkflow = self.request.get('workflow', u'')
pi_container = IProcessInstanceContainer(self.context)
@@ -117,7 +118,7 @@
pi = None
else:
pi = pi_container[reqWorkflow]
-
+
return pi
@@ -128,18 +129,20 @@
def widgets(self):
- if self._getSelWorkflow().data is None:
+ workflow = self._getSelWorkflow()
+ # XXX workflow might be None
+ if workflow is None or workflow.data is None:
return []
schema = self._getSelWorkflow().data.getSchema()
return [getattr(self, name+'_widget')
for name in getFields(schema).keys()]
-
+
def update(self):
status = ''
workflow = self._getSelWorkflow()
-
- if Update in self.request and workflow.data is not None:
+ # XXX workflow might be None
+ if Update in self.request and (workflow is not None and workflow.data is not None):
schema = trustedRemoveSecurityProxy(workflow.data.getSchema())
changed = applyWidgetsChanges(self, schema, target=workflow.data,
names=getFields(schema).keys())
More information about the Zope3-Checkins
mailing list