From cab45059739132e38a7240169e04e0f99743ac29 Mon Sep 17 00:00:00 2001
From: Romain Courteaud <romain@nexedi.com>
Date: Tue, 15 Jan 2008 13:28:11 +0000
Subject: [PATCH] Improve error message.

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

diff --git a/product/ERP5/Document/BusinessTemplate.py b/product/ERP5/Document/BusinessTemplate.py
index 113a91df5b..6c430eebda 100644
--- a/product/ERP5/Document/BusinessTemplate.py
+++ b/product/ERP5/Document/BusinessTemplate.py
@@ -1586,6 +1586,12 @@ class PortalTypeWorkflowChainTemplateItem(BaseTemplateItem):
             chain_dict['chain_%s' % portal_type] = ', '.join(
                                               old_chain_workflow_id_set.keys())
           else:
+            # Check if it has normally to remove a workflow chain, in order to
+            # improve the error message
+            for wf_id in self._objects[path].split(', '):
+              if wf_id.startswith('-'):
+                raise ValueError, '"%s" is not a workflow ID for %s' % \
+                                  (wf_id, portal_type)
             chain_dict['chain_%s' % portal_type] = self._objects[path]
         else:
           chain_dict['chain_%s' % portal_type] = self._objects[path]
-- 
2.30.9