From c17da2c179c325d64f9f5fcd34f0378e3f2ca9d8 Mon Sep 17 00:00:00 2001
From: Wenjie Zheng <wenjie.zheng@tiolive.com>
Date: Thu, 30 Jul 2015 08:15:21 +0000
Subject: [PATCH] WorkflowTool.py: small improvement in
 getWorkflowValueListFor, remove no necessary attribute.

---
 product/ERP5/Tool/WorkflowTool.py | 26 ++++++++++----------------
 1 file changed, 10 insertions(+), 16 deletions(-)

diff --git a/product/ERP5/Tool/WorkflowTool.py b/product/ERP5/Tool/WorkflowTool.py
index ee5eab6d3e..57bb7de650 100644
--- a/product/ERP5/Tool/WorkflowTool.py
+++ b/product/ERP5/Tool/WorkflowTool.py
@@ -196,16 +196,11 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
     workflow_list = []
 
     if isinstance(ob, basestring):
-        portal_type_id = ob
+        portal_type = self.getPortalObject().portal_types._getOb(ob, None)
     elif hasattr(aq_base(ob), 'getPortalType'):
-        portal_type_id = ob.getPortalType()
+        portal_type = self.getPortalObject().portal_types._getOb(ob.getPortalType(), None)
     else:
-        portal_type_id = None
-
-    if portal_type_id is None:
-        return workflow_list
-
-    portal_type = self.getPortalObject().portal_types._getOb(portal_type_id, None)
+        portal_type = None
 
     # Workflow assignment:
     if portal_type is not None:
@@ -704,14 +699,13 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
       for wf_id in workflow_list:
         did[wf_id] = None
         wf = self.getPortalObject().portal_workflow._getOb(wf_id, None)
-        if wf is None:
-          raise NotImplementedError ("Can not find workflow: %s, please check if the workflow exists."%wf_id)
-        a = wf.listObjectActions(info)
-        if a is not None and a != []:
-          actions.extend(a)
-        a = wf.getWorklistVariableMatchDict(info)
-        if a is not None:
-          worklist_dict[wf_id] = a
+        if wf is not None:
+          a = wf.listObjectActions(info)
+          if a is not None and a != []:
+            actions.extend(a)
+          a = wf.getWorklistVariableMatchDict(info)
+          if a is not None:
+            worklist_dict[wf_id] = a
 
     for wf_id in chain:
       did[wf_id] = None
-- 
2.30.9