Commit 8cfdd3cf authored by Jérome Perrin's avatar Jérome Perrin

Chaining a workflow to a non existing portal type was silently ignored.

Fail with explicit message in such situtation.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28513 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 92df3d25
......@@ -1539,7 +1539,7 @@ class PortalTypeWorkflowChainTemplateItem(BaseTemplateItem):
# XXX we don't use the chain (Default) in erp5 so don't keep it
if old_chain_dict != '(Default)' and old_chain_dict != '':
old_chain_workflow_id_set = {}
# get existent workflow id list
# get existing workflow id list
for wf_id in old_chain_dict.split(', '):
old_chain_workflow_id_set[wf_id] = 1
# get new workflow id list
......@@ -1569,6 +1569,10 @@ class PortalTypeWorkflowChainTemplateItem(BaseTemplateItem):
(wf_id, portal_type)
chain_dict['chain_%s' % portal_type] = self._objects[path]
else:
if portal_type not in context.portal_types.objectIds():
raise ValueError('Cannot chain workflow %r to non existing '
'portal type %r' % (self._objects[path],
portal_type))
chain_dict['chain_%s' % portal_type] = self._objects[path]
context.portal_workflow.manage_changeWorkflows(default_chain,
props=chain_dict)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment