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 @@
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.PythonScripts.PythonScript</string>
<string>PythonScript</string>
</tuple>
<none/>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
</pickle>
<pickle>
......@@ -71,14 +68,17 @@
<value> <string>from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
\n
check_result = context.checkConsistency()\n
message_list = []\n
\n
if check_result:\n
err = check_result[0]\n
if hasattr(err, \'getTranslatedMessage\'):\n
raise ValidationFailed, err.getTranslatedMessage()\n
for err in check_result:\n
if getattr(err, \'getTranslatedMessage\', None) is not None:\n
message_list.append(err.getTranslatedMessage())\n
else:\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>
</item>
<item>
......@@ -93,6 +93,12 @@ if check_result:\n
<none/>
</value>
</item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
......@@ -124,11 +130,15 @@ if check_result:\n
<string>Products.DCWorkflow.DCWorkflow</string>
<string>ValidationFailed</string>
<string>_getattr_</string>
<string>context</string>
<string>context</string>
<string>check_result</string>
<string>_getitem_</string>
<string>message_list</string>
<string>_getiter_</string>
<string>err</string>
<string>hasattr</string>
<string>getattr</string>
<string>None</string>
<string>message</string>
<string>_getitem_</string>
</tuple>
</value>
</item>
......
......@@ -111,10 +111,12 @@ for workflow_item in workflow_item_list:\n
else:\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 key == \'error_message\' and not same_type(value, \'\'):\n
value = \'%s\' %value\n
elif key == \'error_message\' and same_type(value, \'\'):\n
if key == \'error_message\' and same_type(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
value = context.Localizer.erp5_ui.gettext(value)\n
if value is marker:\n
......@@ -226,6 +228,9 @@ return result\n
<string>compatibility_name</string>
<string>len</string>
<string>same_type</string>
<string>append</string>
<string>$append0</string>
<string>x</string>
<string>getattr</string>
</tuple>
</value>
......
......@@ -3,11 +3,8 @@
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.PythonScripts.PythonScript</string>
<string>PythonScript</string>
</tuple>
<none/>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
</pickle>
<pickle>
......@@ -82,7 +79,9 @@ if workflow_action in action_id_list:\n
workflow_action,\n
comment=comment,\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
context.REQUEST.RESPONSE.redirect(\n
"%s/view?portal_status_message=%s" %\n
......@@ -150,6 +149,10 @@ if workflow_action in action_id_list:\n
<string>action_id_list</string>
<string>_apply_</string>
<string>message</string>
<string>getattr</string>
<string>None</string>
<string>same_type</string>
<string>_getiter_</string>
</tuple>
</value>
</item>
......
729
\ No newline at end of file
735
\ 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