Commit 5ad424bf authored by Arnaud Fontaine's avatar Arnaud Fontaine

BusinessTemplate: Reset ZODB Components if a Component version_priority is added.

This should have been added and handles twisted use cases such as:
  1. Install bt5 with ZODB Component C1 using version_priority V1.
  2. Install another bt5 adding version_priority V1.
  3. Install Portal Type using C1 as type_class.
  => No reset was done after 2., so C1 was not added to ZODB Component
     registry_dict (__registry_dict) and thus ignored.
parent 8bd2bb47
......@@ -1879,10 +1879,15 @@ class RegisteredVersionPrioritySelectionTemplateItem(BaseTemplateItem):
def build(self, context, **kw):
self._fillObjectDictFromArchive()
def beforeInstall(self):
self.__is_new_version_priority_installed = False
def install(self, context, trashbin, **kw):
if not self._objects:
return
self.beforeInstall()
portal = context.getPortalObject()
registered_tuple_list = []
for value in portal.getVersionPriorityList():
......@@ -1928,9 +1933,18 @@ class RegisteredVersionPrioritySelectionTemplateItem(BaseTemplateItem):
if not inserted:
registered_tuple_list.append((new_version, new_priority))
self.__is_new_version_priority_installed = True
portal.setVersionPriorityList(('%s | %s' % (version, priority)
for version, priority in registered_tuple_list))
self.afterInstall()
def afterInstall(self):
if self.__is_new_version_priority_installed:
self.portal_components.reset(force=True,
reset_portal_type_at_transaction_boundary=True)
def preinstall(self, context, installed_item, **kw):
modified_object_list = {}
class_name_prefix = self.__class__.__name__[:-12]
......
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