From 37ae4006834e684a80923091412c97b58cf2a4ed Mon Sep 17 00:00:00 2001
From: Nicolas Delaby <nicolas@nexedi.com>
Date: Tue, 8 Jun 2010 07:53:17 +0000
Subject: [PATCH] Extend installBusinessTemplatesFromRepositories with new
 update_catalog parameter. It allow to disable the clearing catalog when
 installing business template.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@36072 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Tool/TemplateTool.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/product/ERP5/Tool/TemplateTool.py b/product/ERP5/Tool/TemplateTool.py
index 49c0b6696a..90ce5c7c03 100644
--- a/product/ERP5/Tool/TemplateTool.py
+++ b/product/ERP5/Tool/TemplateTool.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 ##############################################################################
 #
 # Copyright (c) 2002 Nexedi SARL and Contributors. All Rights Reserved.
@@ -61,6 +62,8 @@ import subprocess
 
 WIN = os.name == 'nt'
 
+_MARKER = []
+
 class BusinessTemplateUnknownError(Exception):
   """ Exception raised when the business template
       is impossible to find in the repositories
@@ -1042,7 +1045,7 @@ class TemplateTool (BaseTool):
     security.declareProtected(Permissions.ManagePortal,
         'installBusinessTemplatesFromRepositories' )
     def installBusinessTemplatesFromRepositories(self, template_list,
-        only_newer=True):
+        only_newer=True, update_catalog=_MARKER):
       """Installs template_list from configured repositories by default only newest"""
       # XXX-Luke: This method could replace
       # TemplateTool_installRepositoryBusinessTemplateList while still being
@@ -1057,7 +1060,10 @@ class TemplateTool (BaseTool):
               template_name]['revision']:
             template_document = self.download(template_dict[template_name][
               'url'])
-            template_document.install()
+            if update_catalog is _MARKER:
+              template_document.install()
+            else:
+              template_document.install(update_catalog=update_catalog)
             opreation_log.append('Installed %s with revision %s' % (
               template_document.getTitle(), template_document.getRevision()))
           else:
-- 
2.30.9