[Zope3-checkins] CVS: Zope3/src/zope/app/browser/workflow - instance.py:1.3
Steve Alexander
steve@cat-box.net
Sat, 7 Jun 2003 02:37:51 -0400
Update of /cvs-repository/Zope3/src/zope/app/browser/workflow
In directory cvs.zope.org:/tmp/cvs-serv4294/src/zope/app/browser/workflow
Modified Files:
instance.py
Log Message:
updated to use new-style interface declarations
=== Zope3/src/zope/app/browser/workflow/instance.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/browser/workflow/instance.py:1.2 Tue Jun 3 18:46:17 2003
+++ Zope3/src/zope/app/browser/workflow/instance.py Sat Jun 7 02:37:20 2003
@@ -26,12 +26,11 @@
from zope.app.interfaces.workflow import IProcessInstanceContainer
from zope.app.interfaces.workflow.stateful import IStatefulProcessInstance
-
+
class InstanceContainerView(BrowserView):
__used_for__ = IProcessInstanceContainerAdaptable
-
def _extractContentInfo(self, item):
id, obj = item
info = {}
@@ -40,33 +39,32 @@
# XXX need to urlencode the id in this case !!!
info['url'] = "processinstance.html?pi_name=%s" % id
-
+
return info
-
-
+
def removeObjects(self, ids):
"""Remove objects specified in a list of object ids"""
container = getAdapter(self.context, IProcessInstanceContainer)
for id in ids:
container.__delitem__(id)
-
+
self.request.response.redirect('@@processinstances.html')
-
+
def listContentInfo(self):
return map(self._extractContentInfo,
getAdapter(self.context, IProcessInstanceContainer).items())
-
+
contents = ViewPageTemplateFile('instancecontainer_main.pt')
contentsMacros = contents
-
+
_index = ViewPageTemplateFile('instancecontainer_index.pt')
-
+
def index(self):
if 'index.html' in self.context:
self.request.response.redirect('index.html')
return ''
-
- return self._index()
+
+ return self._index()
# ProcessInstance Details
@@ -76,14 +74,16 @@
# we really want to traverse to the instance and display a view
def _getProcessInstanceData(self, data):
- names = getFieldNames(data.__implements__)
- return dict([(name, getattr(data, name, None),) for name in names ])
+ names = []
+ for interface in providedBy(data):
+ names.append(getFieldNames(interface))
+ return dict([(name, getattr(data, name, None),) for name in names])
def getProcessInstanceInfo(self, pi_name):
info = {}
pi = getAdapter(self.context, IProcessInstanceContainer)[pi_name]
info['status'] = pi.status
-
+
# temporary
if IStatefulProcessInstance.isImplementedBy(pi):
info['outgoing_transitions'] = pi.getOutgoingTransitions()
@@ -92,7 +92,7 @@
info['data'] = self._getProcessInstanceData(pi.data)
else:
info['data'] = None
-
+
return info
def _fireTransition(self, pi_name, id):
@@ -112,5 +112,5 @@
if request.has_key('fire_transition'):
self._fireTransition(pi_name, request['fire_transition'])
-
+
return self._instanceindex()