[Erp5-report] r36036 nicolas - /erp5/trunk/buildout/local-eggs/erp5.recipe.installbusinesst...

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Jun 7 17:08:24 CEST 2010


Author: nicolas
Date: Mon Jun  7 17:08:23 2010
New Revision: 36036

URL: http://svn.erp5.org?rev=36036&view=rev
Log:
Enable new option 'auto' for update_catalog parameter.
This value let the business template deciding if clearing the catalog is
required or not. 
It is enabled by default.

Modified:
    erp5/trunk/buildout/local-eggs/erp5.recipe.installbusinesstemplate/src/erp5/recipe/installbusinesstemplate/__init__.py

Modified: erp5/trunk/buildout/local-eggs/erp5.recipe.installbusinesstemplate/src/erp5/recipe/installbusinesstemplate/__init__.py
URL: http://svn.erp5.org/erp5/trunk/buildout/local-eggs/erp5.recipe.installbusinesstemplate/src/erp5/recipe/installbusinesstemplate/__init__.py?rev=36036&r1=36035&r2=36036&view=diff
==============================================================================
--- erp5/trunk/buildout/local-eggs/erp5.recipe.installbusinesstemplate/src/erp5/recipe/installbusinesstemplate/__init__.py [utf8] (original)
+++ erp5/trunk/buildout/local-eggs/erp5.recipe.installbusinesstemplate/src/erp5/recipe/installbusinesstemplate/__init__.py [utf8] Mon Jun  7 17:08:23 2010
@@ -42,7 +42,7 @@
     # Business Template installation
     options.setdefault('repository_path', '')
     options.setdefault('bt5_list', '')
-    options.setdefault('update_catalog', 'false')
+    options.setdefault('update_catalog', 'auto')
 
     # XML-RPC connection
     options.setdefault('protocol', 'http')
@@ -78,14 +78,28 @@
     connection.portal_templates.updateRepositoryBusinessTemplateList(
                                                        [repository_path], None)
     bt5_list = [bt5 for bt5 in options['bt5_list'].splitlines() if bt5]
-    update_catalog = options['update_catalog'].lower() == 'true' or False
+    update_catalog_option = options['update_catalog'].lower()
+    if update_catalog_option == 'false':
+      update_catalog = False
+    elif update_catalog_option == 'true':
+      update_catalog = True
+    else:
+      # update_catalog_option == 'auto'
+      update_catalog = None 
     while bt5_list:
       partial_bt5_list = bt5_list[:self.MAX_BT_PER_TRANSACTION]
       print 'Installing following business template:',\
                                                     ', '.join(partial_bt5_list)
-      result = connection.portal_templates\
-                 .installBusinessTemplatesFromRepositories(partial_bt5_list,
-                                                           True, update_catalog)
+      if update_catalog is not None:
+        result = connection.portal_templates\
+                .installBusinessTemplatesFromRepositories(partial_bt5_list,
+                                                          True, update_catalog)
+      else:
+        # Avoid overriding default value and let business template
+        # clearing catalog only if needed.
+        result = connection.portal_templates\
+                    .installBusinessTemplatesFromRepositories(partial_bt5_list,
+                                                              True)
 
       bt5_list = bt5_list[self.MAX_BT_PER_TRANSACTION:]
 




More information about the Erp5-report mailing list