From 6d65bf4350e396f9707cf8319daceb7197f73d08 Mon Sep 17 00:00:00 2001 From: Alexandre Boeglin <alex@nexedi.com> Date: Tue, 11 Mar 2008 12:56:59 +0000 Subject: [PATCH] * 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 --- .../erp5_core/Base_checkConsistency.xml | 36 ++++++++++++------- .../Base_getWorkflowHistoryItemList.xml | 11 ++++-- .../erp5_core/Base_workflowStatusModify.xml | 15 ++++---- product/ERP5/bootstrap/erp5_core/bt/revision | 2 +- 4 files changed, 41 insertions(+), 23 deletions(-) diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_checkConsistency.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_checkConsistency.xml index 2e351192653..2a2aff2f384 100644 --- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_checkConsistency.xml +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_checkConsistency.xml @@ -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> diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getWorkflowHistoryItemList.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getWorkflowHistoryItemList.xml index 7defc161e6f..f0056e0755c 100644 --- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getWorkflowHistoryItemList.xml +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getWorkflowHistoryItemList.xml @@ -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> diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_workflowStatusModify.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_workflowStatusModify.xml index 57543991fa8..9608f1e8058 100644 --- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_workflowStatusModify.xml +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_workflowStatusModify.xml @@ -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> diff --git a/product/ERP5/bootstrap/erp5_core/bt/revision b/product/ERP5/bootstrap/erp5_core/bt/revision index b322bede211..191829efad4 100644 --- a/product/ERP5/bootstrap/erp5_core/bt/revision +++ b/product/ERP5/bootstrap/erp5_core/bt/revision @@ -1 +1 @@ -729 \ No newline at end of file +735 \ No newline at end of file -- 2.30.9