From c43dead87f1d75e21964eb320329ee9dececb38e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Wed, 1 Feb 2006 09:46:04 +0000 Subject: [PATCH] fix workflow implementation, so that logic is performed in after script git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5483 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../scripts/disableOtherPreferences.xml | 15 +++++------ .../transitions/disable.xml | 25 +---------------- .../transitions/enable.xml | 27 ++----------------- .../transitions/enable_action.xml | 3 ++- 4 files changed, 12 insertions(+), 58 deletions(-) diff --git a/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/preference_workflow/scripts/disableOtherPreferences.xml b/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/preference_workflow/scripts/disableOtherPreferences.xml index 82a06cf0f4..5dcbed2b75 100755 --- a/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/preference_workflow/scripts/disableOtherPreferences.xml +++ b/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/preference_workflow/scripts/disableOtherPreferences.xml @@ -66,11 +66,10 @@ </item> <item> <key> <string>_body</string> </key> - <value> <string>from Products.DCWorkflow.DCWorkflow import ValidationFailed\n -\n -pref = sci.object\n + <value> <string>pref = sci.object\n portal = sci.getPortal()\n LOG = lambda msg: pref.log("PreferenceWorkflow.disableOtherPreferences on %s"%pref, msg)\n +N_ = context.Base_translateString\n \n # deactivate all other preferences of the same level \n for p in portal.portal_preferences.searchFolder(spec=(\'ERP5 Preference\',)) :\n @@ -82,12 +81,12 @@ for p in portal.portal_preferences.searchFolder(spec=(\'ERP5 Preference\',)) :\n p.getPriority() == pref.getPriority() :\n p.portal_workflow.doActionFor(p,\n \'disable_action\',\n - wf_id=\'preference_workflow\')\n + wf_id=\'preference_workflow\', \n + comment=N_(\'automatically disabled when enabling ${preference_title}\',\n + mapping={\'preference_title\': context.getTitle()}) )\n LOG(\'Deactivated %s\'%p)\n except \'Unauthorized\', a :\n LOG("not authorized to deactivate %s"%p)\n -\n -# vim: syntax=python\n </string> </value> </item> <item> @@ -141,12 +140,12 @@ for p in portal.portal_preferences.searchFolder(spec=(\'ERP5 Preference\',)) :\n <value> <tuple> <string>sci</string> - <string>Products.DCWorkflow.DCWorkflow</string> - <string>ValidationFailed</string> <string>_getattr_</string> <string>pref</string> <string>portal</string> <string>LOG</string> + <string>context</string> + <string>N_</string> <string>_getiter_</string> <string>p</string> <string>a</string> diff --git a/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/preference_workflow/transitions/disable.xml b/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/preference_workflow/transitions/disable.xml index 8bbcbad3bb..9cd3dce09a 100755 --- a/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/preference_workflow/transitions/disable.xml +++ b/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/preference_workflow/transitions/disable.xml @@ -41,7 +41,7 @@ <item> <key> <string>guard</string> </key> <value> - <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + <none/> </value> </item> <item> @@ -67,27 +67,4 @@ </dictionary> </pickle> </record> - <record id="2" aka="AAAAAAAAAAI="> - <pickle> - <tuple> - <tuple> - <string>Products.DCWorkflow.Guard</string> - <string>Guard</string> - </tuple> - <none/> - </tuple> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>roles</string> </key> - <value> - <tuple> - <string>Owner</string> - </tuple> - </value> - </item> - </dictionary> - </pickle> - </record> </ZopeData> diff --git a/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/preference_workflow/transitions/enable.xml b/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/preference_workflow/transitions/enable.xml index 197d33d781..f463940a42 100755 --- a/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/preference_workflow/transitions/enable.xml +++ b/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/preference_workflow/transitions/enable.xml @@ -32,7 +32,7 @@ </item> <item> <key> <string>after_script_name</string> </key> - <value> <string></string> </value> + <value> <string>disableOtherPreferences</string> </value> </item> <item> <key> <string>description</string> </key> @@ -41,7 +41,7 @@ <item> <key> <string>guard</string> </key> <value> - <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + <none/> </value> </item> <item> @@ -67,27 +67,4 @@ </dictionary> </pickle> </record> - <record id="2" aka="AAAAAAAAAAI="> - <pickle> - <tuple> - <tuple> - <string>Products.DCWorkflow.Guard</string> - <string>Guard</string> - </tuple> - <none/> - </tuple> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>roles</string> </key> - <value> - <tuple> - <string>Owner</string> - </tuple> - </value> - </item> - </dictionary> - </pickle> - </record> </ZopeData> diff --git a/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/preference_workflow/transitions/enable_action.xml b/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/preference_workflow/transitions/enable_action.xml index 2360d9786d..0755347643 100755 --- a/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/preference_workflow/transitions/enable_action.xml +++ b/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/preference_workflow/transitions/enable_action.xml @@ -54,7 +54,7 @@ </item> <item> <key> <string>script_name</string> </key> - <value> <string>disableOtherPreferences</string> </value> + <value> <string></string> </value> </item> <item> <key> <string>title</string> </key> @@ -84,6 +84,7 @@ <value> <tuple> <string>Owner</string> + <string>Manager</string> </tuple> </value> </item> -- 2.30.9