From aee646dbee80616578579b756edde7bedfdfbef1 Mon Sep 17 00:00:00 2001
From: Vincent Pelletier <vincent@nexedi.com>
Date: Fri, 8 Feb 2008 11:57:52 +0000
Subject: [PATCH] Add compatibility code to allow upgrading a versoin of
 erp5_core which does not contain Base_updateListboxSelection after upgrading
 erp5_xhtml_style.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19167 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../portal_skins/erp5_xhtml_style/Base_doAction.xml   | 10 ++++++++--
 .../portal_skins/erp5_xhtml_style/Base_doDialog.xml   | 11 +++++++++--
 .../portal_skins/erp5_xhtml_style/Base_doJump.xml     | 11 +++++++++--
 product/ERP5/bootstrap/erp5_xhtml_style/bt/revision   |  2 +-
 4 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_doAction.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_doAction.xml
index 3b1534c0a5..8f44fe5a7c 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_doAction.xml
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_doAction.xml
@@ -71,7 +71,11 @@ preserved_parameters={\'form_id\': form_id, \'cancel_url\': cancel_url}\n
 request = context.REQUEST\n
 \n
 # prevent lose checked itens after click to print\n
-context.Base_updateListboxSelection()\n
+# For backward compatibility, do nothing if\n
+# Base_updateListboxSelection cannot be found.\n
+Base_updateListboxSelection = getattr(context, \'Base_updateListboxSelection\', None)\n
+if Base_updateListboxSelection is not None:\n
+  Base_updateListboxSelection()\n
 \n
 Base_doAction = select_action.split()\n
 if len(Base_doAction) == 0:\n
@@ -178,6 +182,9 @@ return context.ERP5Site_redirect(redirect_url, keep_items=preserved_parameters,
                             <string>N_</string>
                             <string>preserved_parameters</string>
                             <string>request</string>
+                            <string>getattr</string>
+                            <string>None</string>
+                            <string>Base_updateListboxSelection</string>
                             <string>Base_doAction</string>
                             <string>len</string>
                             <string>_getitem_</string>
@@ -189,7 +196,6 @@ return context.ERP5Site_redirect(redirect_url, keep_items=preserved_parameters,
                             <string>type_name</string>
                             <string>str</string>
                             <string>new_content</string>
-                            <string>None</string>
                             <string>template_relative_url</string>
                             <string>template</string>
                             <string>preference</string>
diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_doDialog.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_doDialog.xml
index 382d62b5f1..b757e0122a 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_doDialog.xml
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_doDialog.xml
@@ -66,7 +66,11 @@
         <item>
             <key> <string>_body</string> </key>
             <value> <string># prevent lose checked itens at listbox after click to print\n
-context.Base_updateListboxSelection()\n
+# For backward compatibility, do nothing if\n
+# Base_updateListboxSelection cannot be found.\n
+Base_updateListboxSelection = getattr(context, \'Base_updateListboxSelection\', None)\n
+if Base_updateListboxSelection is not None:\n
+  Base_updateListboxSelection()\n
 \n
 kw.update(context.REQUEST.form)\n
 return context.ERP5Site_redirect(select_dialog.split()[0], keep_items={\'dialog_category\': dialog_category, \'form_id\': form_id, \'cancel_url\': cancel_url}, **kw)\n
@@ -123,8 +127,11 @@ return context.ERP5Site_redirect(select_dialog.split()[0], keep_items={\'dialog_
                             <string>form_id</string>
                             <string>cancel_url</string>
                             <string>kw</string>
-                            <string>_getattr_</string>
+                            <string>getattr</string>
                             <string>context</string>
+                            <string>None</string>
+                            <string>Base_updateListboxSelection</string>
+                            <string>_getattr_</string>
                             <string>_apply_</string>
                             <string>_getitem_</string>
                           </tuple>
diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_doJump.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_doJump.xml
index 210ed0e43b..80cbc0586d 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_doJump.xml
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_doJump.xml
@@ -66,7 +66,11 @@
         <item>
             <key> <string>_body</string> </key>
             <value> <string># prevent lose checked itens after click to print\n
-context.Base_updateListboxSelection()\n
+# For backward compatibility, do nothing if\n
+# Base_updateListboxSelection cannot be found.\n
+Base_updateListboxSelection = getattr(context, \'Base_updateListboxSelection\', None)\n
+if Base_updateListboxSelection is not None:\n
+  Base_updateListboxSelection()\n
 \n
 if select_jump == \'\':\n
   return\n
@@ -124,8 +128,11 @@ return context.ERP5Site_redirect(select_jump,\n
                           <tuple>
                             <string>select_jump</string>
                             <string>kw</string>
-                            <string>_getattr_</string>
+                            <string>getattr</string>
                             <string>context</string>
+                            <string>None</string>
+                            <string>Base_updateListboxSelection</string>
+                            <string>_getattr_</string>
                             <string>container</string>
                             <string>request</string>
                             <string>_apply_</string>
diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision b/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision
index e1170b6414..560731b56b 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision
@@ -1 +1 @@
-489
\ No newline at end of file
+490
\ No newline at end of file
-- 
2.30.9