Commit 069cfdf1 authored by Sebastien Robin's avatar Sebastien Robin

bt: add property on business templates to know if we should force install them

This is very convenient when we use portal_templates.upgradeSite to
make sure some bt will always be installed with force=1. This is
usually used when we have a bt patching other bt.
parent dc496018
......@@ -495,7 +495,8 @@ class TemplateTool (BaseTool):
"""
self.repository_dict = PersistentMapping()
property_list = ('title', 'version', 'revision', 'description', 'license',
'dependency', 'test_dependency', 'provision', 'copyright')
'dependency', 'test_dependency', 'provision', 'copyright',
'force_install')
#LOG('updateRepositoryBusiessTemplateList', 0,
# 'repository_list = %r' % (repository_list,))
for repository in repository_list:
......@@ -562,6 +563,8 @@ class TemplateTool (BaseTool):
temp_property_dict.get('provision', ())
property_dict['copyright_list'] = \
temp_property_dict.get('copyright', ())
property_dict['force_install'] = \
int(temp_property_dict.get('force_install', [0])[0])
property_dict_list.append(property_dict)
finally:
......@@ -1298,8 +1301,8 @@ class TemplateTool (BaseTool):
This is useful if we want to keep an old business
template without updating it and without removing it
deprecated_reinstall_set: this parameter needs to be removed
by setting it at business template level.
deprecated_reinstall_set: this parameter is obsolete, please set
force_install property at business template level
It list all business templates who needs
reinstall
......@@ -1323,7 +1326,7 @@ class TemplateTool (BaseTool):
template_list=dependency_list)
update_bt5_list.sort(key=lambda x: dependency_list.index(x.title))
for bt5 in update_bt5_list:
reinstall = bt5.title in deprecated_reinstall_set
reinstall = bt5.title in deprecated_reinstall_set or bt5.force_install
if (not(reinstall) and bt5.version_state == 'present') or \
bt5.title in keep_bt5_id_set:
continue
......
......@@ -125,6 +125,7 @@ dependency_list
test_dependency_list
provision_list
copyright_list
force_install
'''.split())
def __init__(self):
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ERP5Form" module="Products.ERP5Form.Form"/>
<global name="ERP5 Form" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......@@ -115,6 +115,7 @@
<string>my_description</string>
<string>my_comment</string>
<string>my_maintainer_list</string>
<string>my_force_install</string>
</list>
</value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>description</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_force_install</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>description</string> </key>
<value> <string>Define if this business template should always force reinstallation of this bt. This is mainly useful to patch other business templates.</string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_checkbox</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Force Install</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Standard Property" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>elementary_type/boolean</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Define if this business template should always force reinstallation of this bt. This is mainly useful to patch other business templates.</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>force_install_property</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Standard Property</string> </value>
</item>
<item>
<key> <string>property_default</string> </key>
<value> <string>python: False</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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