#343227: display the workflow history of any entity
authorNicolas Chauvat <nicolas.chauvat@logilab.fr>
Thu, 23 Jul 2009 14:12:34 +0200
changeset 2440 8e6b83e3b6b5
parent 2439 77d8dd77acb3
child 2441 d7f0e551d0fa
#343227: display the workflow history of any entity
web/test/unittest_viewselector.py
web/views/workflow.py
--- a/web/test/unittest_viewselector.py	Thu Jul 23 14:12:18 2009 +0200
+++ b/web/test/unittest_viewselector.py	Thu Jul 23 14:12:34 2009 +0200
@@ -174,6 +174,7 @@
                               ('text', baseviews.TextView),
                               ('treeview', treeview.TreeView),
                               ('vcard', vcard.VCardCWUserView),
+                              ('wfhistory', workflow.WFHistoryView),
                               ('xbel', xbel.XbelView),
                               ('xml', xmlrss.XMLView),
                               ])
--- a/web/views/workflow.py	Thu Jul 23 14:12:18 2009 +0200
+++ b/web/views/workflow.py	Thu Jul 23 14:12:34 2009 +0200
@@ -67,13 +67,9 @@
     def redirectpath(self, entity):
         return entity.rest_path()
 
-
-class WFHistoryVComponent(component.EntityVComponent):
-    """display the workflow history for entities supporting it"""
+class WFHistoryView(EntityView):
     id = 'wfhistory'
-    __select__ = (component.EntityVComponent.__select__
-                  & relation_possible('wf_info_for', role='object'))
-    context = 'navcontentbottom'
+    __select__ = relation_possible('wf_info_for', role='object')
     title = _('Workflow history')
 
     def cell_call(self, row, col, view=None):
@@ -102,6 +98,15 @@
             self.wview('table', rset, title=_(self.title), displayactions=False,
                        displaycols=displaycols, headers=headers)
 
+class WFHistoryVComponent(component.EntityVComponent):
+    """display the workflow history for entities supporting it"""
+    id = 'wfhistory'
+    __select__ = WFHistoryView.__select__ & component.EntityVComponent.__select__
+    context = 'navcontentbottom'
+    title = _('Workflow history')
+
+    def cell_call(self, row, col, view=None):
+        self.wview('wfhistory', self.rset, row=row, col=col, view=view)
 
 # workflow entity types views #################################################