Commit e58ab21c authored by Vincent Pelletier's avatar Vincent Pelletier

TemplateTool: Update translation table when upgrading site

Do it once, after any business template deletion and install happened.
parent 4c9d9f0e
......@@ -1429,6 +1429,7 @@ class TemplateTool (BaseTool):
# make sure that we updated information on repository
self.updateRepositoryBusinessTemplateList(self.getRepositoryList())
# do upgrade
is_something_changed = False
message_list = []
deprecated_reinstall_set = deprecated_reinstall_set or set()
def append(message):
......@@ -1449,6 +1450,7 @@ class TemplateTool (BaseTool):
for bt in to_remove_bt5_list:
if bt.title in keep_bt5_id_set:
continue
is_something_changed = True
append("Uninstall business template %s" % bt.title)
if not dry_run:
# XXX Here is missing parameters to really remove stuff
......@@ -1461,13 +1463,17 @@ class TemplateTool (BaseTool):
if (not(reinstall) and bt5.version_state == 'present') or \
bt5.title in keep_bt5_id_set:
continue
is_something_changed = True
append("Update %s business template in state %s%s" % \
(bt5.title, bt5.version_state, (reinstall and ' (reinstall)') or ''))
if not dry_run:
bt5_url = "%s/%s" % (bt5.repository, bt5.title)
self.updateBusinessTemplateFromUrl(bt5_url, reinstall=reinstall,
update_catalog=update_catalog)
if is_something_changed:
append("Update translation table")
if not dry_run:
self.ERP5Site_updateTranslationTable()
return message_list
InitializeClass(TemplateTool)
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