[Erp5-report] r28513 - /erp5/trunk/products/ERP5/Document/BusinessTemplate.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Aug 20 15:56:26 CEST 2009


Author: jerome
Date: Thu Aug 20 15:56:25 2009
New Revision: 28513

URL: http://svn.erp5.org?rev=28513&view=rev
Log:
Chaining a workflow to a non existing portal type was silently ignored.
Fail with explicit message in such situtation.

Modified:
    erp5/trunk/products/ERP5/Document/BusinessTemplate.py

Modified: erp5/trunk/products/ERP5/Document/BusinessTemplate.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/BusinessTemplate.py?rev=28513&r1=28512&r2=28513&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/BusinessTemplate.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/BusinessTemplate.py [utf8] Thu Aug 20 15:56:25 2009
@@ -1539,7 +1539,7 @@
           # 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 @@
                                   (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)




More information about the Erp5-report mailing list