src/pyams_workflow/content.py
changeset 17 21b836971c56
parent 11 f25326715002
child 19 31bee5428853
--- a/src/pyams_workflow/content.py	Thu Oct 08 11:38:12 2015 +0200
+++ b/src/pyams_workflow/content.py	Thu Oct 08 11:39:17 2015 +0200
@@ -111,17 +111,15 @@
 
     def is_visible(self, request=None):
         # associated workflow?
-        wf_name = IWorkflowManagedContent(self.__parent__).workflow_name
+        content = IWorkflowManagedContent(self.__parent__)
+        wf_name = content.workflow_name
         if not wf_name:
             return True
         # check workflow?
-        workflow = query_utility(IWorkflow, name=wf_name)
-        if workflow is None:
-            return False
-        if workflow.view_permission:
+        if content.view_permission:
             if request is None:
                 request = check_request()
-            if not request.has_permission(workflow.view_permission, context=self.__parent__):
+            if not request.has_permission(content.view_permission, context=self.__parent__):
                 return False
         return self.is_published()