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