From eb84013025ba51d677a4e5d4465236dc838b8a82 Mon Sep 17 00:00:00 2001
From: Nicolas Delaby <nicolas@nexedi.com>
Date: Mon, 7 Jun 2010 14:49:20 +0000
Subject: [PATCH] If update_catalog parameter is passed explicitely, do not
 override it. Otherwise business_template.install(update_catalog=False) can
 clear the catalog.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@36031 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Document/BusinessTemplate.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/product/ERP5/Document/BusinessTemplate.py b/product/ERP5/Document/BusinessTemplate.py
index 214764d64e..c4c4011506 100644
--- a/product/ERP5/Document/BusinessTemplate.py
+++ b/product/ERP5/Document/BusinessTemplate.py
@@ -106,6 +106,7 @@ catalog_method_filter_list = ('_filter_expression_archive',
                               '_filter_type_archive',)
 
 INSTALLED_BT_FOR_DIFF = 'installed_bt_for_diff'
+_MARKER = []
 
 def _getCatalog(acquisition_context):
   """
@@ -5208,7 +5209,7 @@ Business Template is a set of definitions, such as skins, portal types and categ
       return modified_object_list
 
     def _install(self, force=1, object_to_update=None, update_translation=0,
-                 update_catalog=0, **kw):
+                 update_catalog=_MARKER, **kw):
       """
         Install a new Business Template, if force, all will be upgraded or installed
         otherwise depends of dict object_to_update
@@ -5276,8 +5277,12 @@ Business Template is a set of definitions, such as skins, portal types and categ
                                trashbin=trashbin, installed_bt=installed_bt)
 
       # update catalog if necessary
-      if force and self.isCatalogUpdatable():
+      if update_catalog is _MARKER and force and self.isCatalogUpdatable():
+        # override update_catalog parameter only if value
+        # is not explicitely passed.
         update_catalog = 1
+      else:
+        update_catalog = 0
       if update_catalog:
         catalog = _getCatalogValue(self)
         if (catalog is None) or (not site.isIndexable):
-- 
2.30.9