From bf1178625b08ce5b7410c16049d6efca5821b47d Mon Sep 17 00:00:00 2001
From: Kazuhiko Shiozaki <kazuhiko@nexedi.com>
Date: Mon, 22 Jun 2009 20:08:18 +0000
Subject: [PATCH] do not raise an error if a workflow is missing in the chain,
 because it can happen when it is removed by another business template.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27761 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Document/BusinessTemplate.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/product/ERP5/Document/BusinessTemplate.py b/product/ERP5/Document/BusinessTemplate.py
index c188593e82..7a88053bd8 100644
--- a/product/ERP5/Document/BusinessTemplate.py
+++ b/product/ERP5/Document/BusinessTemplate.py
@@ -1470,10 +1470,13 @@ class PortalTypeWorkflowChainTemplateItem(BaseTemplateItem):
         else:
           workflow_name = workflow
         if workflow[0] != '-' and \
-            workflow_name not in chain_dict['chain_%s' % portal_type]:
+            workflow_name not in chain_dict['chain_%s' % portal_type].split(', '):
           if not self.is_bt_for_diff:
-            raise NotFound, 'workflow %s not found in chain for portal_type %s'\
-                % (workflow, portal_type)
+            # here, we use 'LOG' instead of 'raise', because it can
+            # happen when a workflow is removed from the chain by
+            # another business template.
+            LOG('BusinessTemplate', WARNING, 'workflow %s not found in chain for portal_type %s'\
+                % (workflow, portal_type))
         if self._objects.has_key(portal_type):
           # other workflow id already defined for this portal type
           self._objects[portal_type].append(workflow)
-- 
2.30.9