From 1e6366ba453c868760c5f6688bf659531909463e Mon Sep 17 00:00:00 2001
From: Rafael Monnerat <rafael@nexedi.com>
Date: Tue, 12 Oct 2010 19:23:51 +0000
Subject: [PATCH] Define which bt5 will update catalog on Upgrader Signature.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@39074 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../ERP5Site_getUpgraderSignature.xml         |   7 +
 .../ERP5Site_upgradeBusinessTemplateList.xml  |  10 +-
 .../TemplateTool_isUpdateCatalogRequired.xml  | 127 ------------------
 bt5/erp5_upgrader/bt/revision                 |   2 +-
 4 files changed, 13 insertions(+), 133 deletions(-)
 delete mode 100644 bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/TemplateTool_isUpdateCatalogRequired.xml

diff --git a/bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/ERP5Site_getUpgraderSignature.xml b/bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/ERP5Site_getUpgraderSignature.xml
index 8679c20845..aa14899398 100644
--- a/bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/ERP5Site_getUpgraderSignature.xml
+++ b/bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/ERP5Site_getUpgraderSignature.xml
@@ -153,6 +153,11 @@ REQUIRED_BT5_ID_LIST = ("erp5_core",\n
                         "express_customisation",\n
                        )\n
 \n
+# A list bt5 which are required to upgrade catalog.\n
+# After the bt5 be updated, update catalog will be trigger.\n
+UPDATE_CATALOG_BT5_ID_LIST = ()\n
+\n
+\n
 # Call some scripts inside same transaction before or after BT update\n
 BEFORE_TRIGGERED_BT5_SCRIPT_ID_DICT = {}\n
 AFTER_TRIGGERED_BT5_SCRIPT_ID_DICT = {\'erp5_mysql_innodb_catalog\': (\'ERP5Site_updateSitePropertyForTestOnly\',)}\n
@@ -554,6 +559,7 @@ signature_dict = {\n
  , \'required_bt5_id_list\': REQUIRED_BT5_ID_LIST\n
    # Provides a list of bt5 which can be upgraded by the upgrader (if already installed)\n
  , \'upgradable_bt5_id_list\': UPGRADABLE_BT5_ID_LIST\n
+ , \'update_catalog_bt5_id_list\' : UPDATE_CATALOG_BT5_ID_LIST\n
  , \'before_triggered_bt5_id_dict\': BEFORE_TRIGGERED_BT5_SCRIPT_ID_DICT\n
  , \'after_triggered_bt5_id_dict\': AFTER_TRIGGERED_BT5_SCRIPT_ID_DICT\n
    # Provide a list of bt5 which require reinstallation\n
@@ -631,6 +637,7 @@ else:\n
                             <string>_getattr_</string>
                             <string>UPGRADABLE_BT5_ID_LIST</string>
                             <string>REQUIRED_BT5_ID_LIST</string>
+                            <string>UPDATE_CATALOG_BT5_ID_LIST</string>
                             <string>BEFORE_TRIGGERED_BT5_SCRIPT_ID_DICT</string>
                             <string>AFTER_TRIGGERED_BT5_SCRIPT_ID_DICT</string>
                             <string>REINSTALABLE_BT5_ID_LIST</string>
diff --git a/bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/ERP5Site_upgradeBusinessTemplateList.xml b/bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/ERP5Site_upgradeBusinessTemplateList.xml
index 79799407ba..78e2e8927e 100644
--- a/bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/ERP5Site_upgradeBusinessTemplateList.xml
+++ b/bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/ERP5Site_upgradeBusinessTemplateList.xml
@@ -2,10 +2,7 @@
 <ZopeData>
   <record id="1" aka="AAAAAAAAAAE=">
     <pickle>
-      <tuple>
-        <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
-        <tuple/>
-      </tuple>
+      <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
     </pickle>
     <pickle>
       <dictionary>
@@ -94,6 +91,8 @@ upgradable_bt5_id_list = signature[\'upgradable_bt5_id_list\']\n
 reinstalable_bt5_id_list = signature[\'reinstalable_bt5_id_list\']\n
 before_triggered_bt5_id_dict = signature[\'before_triggered_bt5_id_dict\']\n
 after_triggered_bt5_id_dict = signature[\'after_triggered_bt5_id_dict\']\n
+update_catalog_bt5_id_list = signature[\'update_catalog_bt5_id_list\']\n
+\n
 \n
 base_url_list = signature[\'bt5_base_url_list\']\n
 installed_bt5_title_list = [o.getTitle() for o in portal_templates.getInstalledBusinessTemplateList()]\n
@@ -117,7 +116,7 @@ def installBT5(bt5_title, previous_bt5, bt5_counter):\n
     # We must make sure all documents from previous installations \n
     # are already indexed (specially categories).\n
     kw[\'after_method_id\'] = "immediateReindexObject"\n
-  update_catalog = portal_templates.TemplateTool_isUpdateCatalogRequired(bt5_title)\n
+  update_catalog = bt5_title in update_catalog_bt5_id_list \n
   before_triggered_bt5_id_list = before_triggered_bt5_id_dict.get(bt5_title, ())\n
   after_triggered_bt5_id_list = after_triggered_bt5_id_dict.get(bt5_title, ())\n
   keep_original_list = signature[\'keep_original_dict\'].get(bt5_title, ())\n
@@ -227,6 +226,7 @@ return message_list\n
                             <string>reinstalable_bt5_id_list</string>
                             <string>before_triggered_bt5_id_dict</string>
                             <string>after_triggered_bt5_id_dict</string>
+                            <string>update_catalog_bt5_id_list</string>
                             <string>base_url_list</string>
                             <string>append</string>
                             <string>$append0</string>
diff --git a/bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/TemplateTool_isUpdateCatalogRequired.xml b/bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/TemplateTool_isUpdateCatalogRequired.xml
deleted file mode 100644
index 2371f9b9a2..0000000000
--- a/bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/TemplateTool_isUpdateCatalogRequired.xml
+++ /dev/null
@@ -1,127 +0,0 @@
-<?xml version="1.0"?>
-<ZopeData>
-  <record id="1" aka="AAAAAAAAAAE=">
-    <pickle>
-      <tuple>
-        <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
-        <tuple/>
-      </tuple>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>Script_magic</string> </key>
-            <value> <int>3</int> </value>
-        </item>
-        <item>
-            <key> <string>_bind_names</string> </key>
-            <value>
-              <object>
-                <klass>
-                  <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
-                </klass>
-                <tuple/>
-                <state>
-                  <dictionary>
-                    <item>
-                        <key> <string>_asgns</string> </key>
-                        <value>
-                          <dictionary>
-                            <item>
-                                <key> <string>name_container</string> </key>
-                                <value> <string>container</string> </value>
-                            </item>
-                            <item>
-                                <key> <string>name_context</string> </key>
-                                <value> <string>context</string> </value>
-                            </item>
-                            <item>
-                                <key> <string>name_m_self</string> </key>
-                                <value> <string>script</string> </value>
-                            </item>
-                            <item>
-                                <key> <string>name_subpath</string> </key>
-                                <value> <string>traverse_subpath</string> </value>
-                            </item>
-                          </dictionary>
-                        </value>
-                    </item>
-                  </dictionary>
-                </state>
-              </object>
-            </value>
-        </item>
-        <item>
-            <key> <string>_body</string> </key>
-            <value> <string>"""\n
- By default the upgrade is never required for None of\n
- Business template.\n
-\n
- This script will be probably rewrite on other skin folder.\n
-"""\n
-return 0\n
-</string> </value>
-        </item>
-        <item>
-            <key> <string>_code</string> </key>
-            <value>
-              <none/>
-            </value>
-        </item>
-        <item>
-            <key> <string>_params</string> </key>
-            <value> <string>bt5_title</string> </value>
-        </item>
-        <item>
-            <key> <string>errors</string> </key>
-            <value>
-              <tuple/>
-            </value>
-        </item>
-        <item>
-            <key> <string>func_code</string> </key>
-            <value>
-              <object>
-                <klass>
-                  <global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
-                </klass>
-                <tuple/>
-                <state>
-                  <dictionary>
-                    <item>
-                        <key> <string>co_argcount</string> </key>
-                        <value> <int>1</int> </value>
-                    </item>
-                    <item>
-                        <key> <string>co_varnames</string> </key>
-                        <value>
-                          <tuple>
-                            <string>bt5_title</string>
-                          </tuple>
-                        </value>
-                    </item>
-                  </dictionary>
-                </state>
-              </object>
-            </value>
-        </item>
-        <item>
-            <key> <string>func_defaults</string> </key>
-            <value>
-              <none/>
-            </value>
-        </item>
-        <item>
-            <key> <string>id</string> </key>
-            <value> <string>TemplateTool_isUpdateCatalogRequired</string> </value>
-        </item>
-        <item>
-            <key> <string>warnings</string> </key>
-            <value>
-              <tuple/>
-            </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-</ZopeData>
diff --git a/bt5/erp5_upgrader/bt/revision b/bt5/erp5_upgrader/bt/revision
index 40ca05e7ba..b18fcc5ba2 100644
--- a/bt5/erp5_upgrader/bt/revision
+++ b/bt5/erp5_upgrader/bt/revision
@@ -1 +1 @@
-534
\ No newline at end of file
+535
\ No newline at end of file
-- 
2.30.9