make wfhistory non selectable for entities without record in its workflow history stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 30 Nov 2009 11:15:59 +0100
branchstable
changeset 3948 24a25b676671
parent 3947 8d06bce45c02
child 3950 a014b886b8b4
make wfhistory non selectable for entities without record in its workflow history
web/views/workflow.py
--- a/web/views/workflow.py	Mon Nov 30 10:24:01 2009 +0100
+++ b/web/views/workflow.py	Mon Nov 30 11:15:59 2009 +0100
@@ -17,7 +17,7 @@
 from cubicweb import Unauthorized, view
 from cubicweb.selectors import (implements, has_related_entities, one_line_rset,
                                 relation_possible, match_form_params,
-                                entity_implements)
+                                entity_implements, score_entity)
 from cubicweb.interfaces import IWorkflowable
 from cubicweb.view import EntityView
 from cubicweb.schema import display_name
@@ -77,7 +77,8 @@
 
 class WFHistoryView(EntityView):
     id = 'wfhistory'
-    __select__ = relation_possible('wf_info_for', role='object')
+    __select__ = relation_possible('wf_info_for', role='object') & \
+                 score_entity(lambda x: x.workflow_history)
     title = _('Workflow history')
 
     def cell_call(self, row, col, view=None):