From 49e44f94dc230195909bcfe75754b2b0b02210b4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Mon, 24 Apr 2006 12:12:55 +0000
Subject: [PATCH] Clear the cache when validating a preference

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6885 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../scripts/disableOtherPreferences.xml        | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 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 69739c4f36..1c68d83757 100644
--- 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,10 +66,13 @@
         </item>
         <item>
             <key> <string>_body</string> </key>
-            <value> <string>pref = sci.object\n
+            <value> <string>from Products.ERP5Type.Cache import clearCache\n
+from Products.ERP5Type.Message import Message\n
+\n
+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_ = lambda msg, **kw: Message(\'erp5_ui\', msg, **kw)\n
 \n
 # deactivate all other preferences of the same level \n
 for p in portal.portal_preferences.searchFolder(spec=(\'ERP5 Preference\',)) :\n
@@ -82,11 +85,12 @@ for p in portal.portal_preferences.searchFolder(spec=(\'ERP5 Preference\',)) :\n
         p.portal_workflow.doActionFor(p,\n
            \'disable_action\',\n
            wf_id=\'preference_workflow\', \n
-           comment=N_(\'automatically disabled when enabling ${preference_title}\',\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
+clearCache(method_id="PreferenceTool.CachingMethod.")\n
 </string> </value>
         </item>
         <item>
@@ -140,14 +144,18 @@ for p in portal.portal_preferences.searchFolder(spec=(\'ERP5 Preference\',)) :\n
                         <value>
                           <tuple>
                             <string>sci</string>
+                            <string>Products.ERP5Type.Cache</string>
+                            <string>clearCache</string>
+                            <string>Products.ERP5Type.Message</string>
+                            <string>Message</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>context</string>
                             <string>a</string>
                           </tuple>
                         </value>
-- 
2.30.9