Commit 16e80069 authored by Nicolas Delaby's avatar Nicolas Delaby

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.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@36036 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b8aa54ad
...@@ -42,7 +42,7 @@ class Recipe(object): ...@@ -42,7 +42,7 @@ class Recipe(object):
# Business Template installation # Business Template installation
options.setdefault('repository_path', '') options.setdefault('repository_path', '')
options.setdefault('bt5_list', '') options.setdefault('bt5_list', '')
options.setdefault('update_catalog', 'false') options.setdefault('update_catalog', 'auto')
# XML-RPC connection # XML-RPC connection
options.setdefault('protocol', 'http') options.setdefault('protocol', 'http')
...@@ -78,14 +78,28 @@ class Recipe(object): ...@@ -78,14 +78,28 @@ class Recipe(object):
connection.portal_templates.updateRepositoryBusinessTemplateList( connection.portal_templates.updateRepositoryBusinessTemplateList(
[repository_path], None) [repository_path], None)
bt5_list = [bt5 for bt5 in options['bt5_list'].splitlines() if bt5] 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: while bt5_list:
partial_bt5_list = bt5_list[:self.MAX_BT_PER_TRANSACTION] partial_bt5_list = bt5_list[:self.MAX_BT_PER_TRANSACTION]
print 'Installing following business template:',\ print 'Installing following business template:',\
', '.join(partial_bt5_list) ', '.join(partial_bt5_list)
result = connection.portal_templates\ if update_catalog is not None:
.installBusinessTemplatesFromRepositories(partial_bt5_list, result = connection.portal_templates\
True, update_catalog) .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:] bt5_list = bt5_list[self.MAX_BT_PER_TRANSACTION:]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment