Commit 6d65bf43 authored by Alexandre Boeglin's avatar Alexandre Boeglin

* Base_checkConsistency: raise a list of Messages as exception argument,...

* Base_checkConsistency: raise a list of Messages as exception argument, instead of only the first Message
* Base_getWorkflowHistoryItemList, Base_workflowStatusModify: add ability to handle a list of message

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19786 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 10b31ea5
...@@ -3,11 +3,8 @@ ...@@ -3,11 +3,8 @@
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<tuple> <tuple>
<tuple> <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<string>Products.PythonScripts.PythonScript</string> <tuple/>
<string>PythonScript</string>
</tuple>
<none/>
</tuple> </tuple>
</pickle> </pickle>
<pickle> <pickle>
...@@ -71,14 +68,17 @@ ...@@ -71,14 +68,17 @@
<value> <string>from Products.DCWorkflow.DCWorkflow import ValidationFailed\n <value> <string>from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
\n \n
check_result = context.checkConsistency()\n check_result = context.checkConsistency()\n
message_list = []\n
\n \n
if check_result:\n for err in check_result:\n
err = check_result[0]\n if getattr(err, \'getTranslatedMessage\', None) is not None:\n
if hasattr(err, \'getTranslatedMessage\'):\n message_list.append(err.getTranslatedMessage())\n
raise ValidationFailed, err.getTranslatedMessage()\n
else:\n else:\n
# backward compatibility:\n # backward compatibility:\n
raise ValidationFailed, "%s: %s" % (err[4], err[3])\n message.append(err[3])\n
\n
if message_list:\n
raise ValidationFailed, message_list\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -93,6 +93,12 @@ if check_result:\n ...@@ -93,6 +93,12 @@ if check_result:\n
<none/> <none/>
</value> </value>
</item> </item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
...@@ -124,11 +130,15 @@ if check_result:\n ...@@ -124,11 +130,15 @@ if check_result:\n
<string>Products.DCWorkflow.DCWorkflow</string> <string>Products.DCWorkflow.DCWorkflow</string>
<string>ValidationFailed</string> <string>ValidationFailed</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>check_result</string> <string>check_result</string>
<string>_getitem_</string> <string>message_list</string>
<string>_getiter_</string>
<string>err</string> <string>err</string>
<string>hasattr</string> <string>getattr</string>
<string>None</string>
<string>message</string>
<string>_getitem_</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -111,10 +111,12 @@ for workflow_item in workflow_item_list:\n ...@@ -111,10 +111,12 @@ for workflow_item in workflow_item_list:\n
else:\n else:\n
value = wf_transitions.get(value, marker) and (wf_transitions[value].id or wf_transitions[value].actbox_name) or value\n value = wf_transitions.get(value, marker) and (wf_transitions[value].id or wf_transitions[value].actbox_name) or value\n
if display:\n if display:\n
if key == \'error_message\' and not same_type(value, \'\'):\n if key == \'error_message\' and same_type(value, \'\'):\n
value = \'%s\' %value\n
elif key == \'error_message\' and same_type(value, \'\'):\n
value = context.Localizer.erp5_ui.gettext(value)\n value = context.Localizer.erp5_ui.gettext(value)\n
elif key == \'error_message\' and same_type(value, []):\n
value = \'. \'.join([\'%s\' % x for x in value])\n
elif key == \'error_message\':\n
value = \'%s\' % value\n
elif same_type(value, \'\') and key in ( \'action\', \'state\' ): \n elif same_type(value, \'\') and key in ( \'action\', \'state\' ): \n
value = context.Localizer.erp5_ui.gettext(value)\n value = context.Localizer.erp5_ui.gettext(value)\n
if value is marker:\n if value is marker:\n
...@@ -226,6 +228,9 @@ return result\n ...@@ -226,6 +228,9 @@ return result\n
<string>compatibility_name</string> <string>compatibility_name</string>
<string>len</string> <string>len</string>
<string>same_type</string> <string>same_type</string>
<string>append</string>
<string>$append0</string>
<string>x</string>
<string>getattr</string> <string>getattr</string>
</tuple> </tuple>
</value> </value>
......
...@@ -3,11 +3,8 @@ ...@@ -3,11 +3,8 @@
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<tuple> <tuple>
<tuple> <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<string>Products.PythonScripts.PythonScript</string> <tuple/>
<string>PythonScript</string>
</tuple>
<none/>
</tuple> </tuple>
</pickle> </pickle>
<pickle> <pickle>
...@@ -82,7 +79,9 @@ if workflow_action in action_id_list:\n ...@@ -82,7 +79,9 @@ if workflow_action in action_id_list:\n
workflow_action,\n workflow_action,\n
comment=comment,\n comment=comment,\n
**kw)\n **kw)\n
except ValidationFailed, message: \n except ValidationFailed, message:\n
if getattr(message, \'msg\', None) and same_type(message.msg, []):\n
message = \'. \'.join(\'%s\' % x for x in message.msg)\n
if not batch :\n if not batch :\n
context.REQUEST.RESPONSE.redirect(\n context.REQUEST.RESPONSE.redirect(\n
"%s/view?portal_status_message=%s" %\n "%s/view?portal_status_message=%s" %\n
...@@ -150,6 +149,10 @@ if workflow_action in action_id_list:\n ...@@ -150,6 +149,10 @@ if workflow_action in action_id_list:\n
<string>action_id_list</string> <string>action_id_list</string>
<string>_apply_</string> <string>_apply_</string>
<string>message</string> <string>message</string>
<string>getattr</string>
<string>None</string>
<string>same_type</string>
<string>_getiter_</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
729 735
\ No newline at end of file \ No newline at end of file
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