Commit 4301bf87 authored by Ayush Tiwari's avatar Ayush Tiwari

bt5_config: Do not flatten Business Manager

parent b6e0d3b5
...@@ -1654,13 +1654,20 @@ class TemplateTool (BaseTool): ...@@ -1654,13 +1654,20 @@ class TemplateTool (BaseTool):
""" """
Combines multiple BM to form single flattened BM Combines multiple BM to form single flattened BM
""" """
new_bm_list = bm_list[:]
# Create the final Business Manager # Create the final Business Manager
if len(bm_list) == 1: if len(bm_list) == 1:
combinedBM = bm_list[0] combinedBM = new_bm_list[0]
else: else:
# Better to create a new Business Manager than to make change
# in the installed one
combinedBM = self.newContent(portal_type='Business Manager')
combinedBM.build()
# Summation should also consider arithmetic on the Business Item(s) # Summation should also consider arithmetic on the Business Item(s)
# having same path and layer and combine them. # having same path and layer and combine them.
combinedBM = reduce(lambda x, y: x+y, bm_list)
new_bm_list.insert(0, combinedBM)
combinedBM = reduce(lambda x, y: x+y, new_bm_list)
# XXX: We are missing the part of creating installed_BM for all the BM # XXX: We are missing the part of creating installed_BM for all the BM
# we have in bm_list, because this would be needed in case we build # we have in bm_list, because this would be needed in case we build
...@@ -1668,7 +1675,7 @@ class TemplateTool (BaseTool): ...@@ -1668,7 +1675,7 @@ class TemplateTool (BaseTool):
# Reduce the final Business Manager # Reduce the final Business Manager
combinedBM.reduceBusinessManager() combinedBM.reduceBusinessManager()
combinedBM.flattenBusinessManager() # combinedBM.flattenBusinessManager()
return combinedBM return combinedBM
...@@ -1678,8 +1685,9 @@ class TemplateTool (BaseTool): ...@@ -1678,8 +1685,9 @@ class TemplateTool (BaseTool):
""" """
Run installation on flattened Business Manager Run installation on flattened Business Manager
""" """
if bm.getStatus() == 'flattened': if bm.getStatus() == 'reduced':
# Run install on separate Business Item one by one # Run install on separate Business Item one by one
import pdb; pdb.set_trace()
for path_item in bm._path_item_list: for path_item in bm._path_item_list:
path_item.install(self) path_item.install(self)
else: else:
...@@ -1695,10 +1703,10 @@ class TemplateTool (BaseTool): ...@@ -1695,10 +1703,10 @@ class TemplateTool (BaseTool):
installed_bm_list = self.getInstalledBusinessManagerList() installed_bm_list = self.getInstalledBusinessManagerList()
installed_bm_title_list = self.getInstalledBusinessManagerTitleList() installed_bm_title_list = self.getInstalledBusinessManagerTitleList()
installed_bm_dict = dict(zip(installed_bm_title_list, installed_bm_list)) installed_bm_dict = dict(zip(installed_bm_title_list, installed_bm_list))
for bm in bm_list: for bm in bm_list:
if bm.title in installed_bm_title_list: if bm.title in installed_bm_title_list:
# Not very suitable way to look for already installed BM # Not very suitable way to look for already installed BM
installed_bm = installed_bm_dict[bm.title] installed_bm = installed_bm_dict[bm.title]
# XXX: Installed BM is already reduced. For the Business Manager we # XXX: Installed BM is already reduced. For the Business Manager we
...@@ -1708,6 +1716,7 @@ class TemplateTool (BaseTool): ...@@ -1708,6 +1716,7 @@ class TemplateTool (BaseTool):
else: else:
final_bm_list.append(bm) final_bm_list.append(bm)
combinedBM = self.combineMultipleBusinessManager(final_bm_list) combinedBM = self.combineMultipleBusinessManager(final_bm_list)
self.installBusinessManager(combinedBM) self.installBusinessManager(combinedBM)
...@@ -1732,7 +1741,7 @@ class TemplateTool (BaseTool): ...@@ -1732,7 +1741,7 @@ class TemplateTool (BaseTool):
def compareBusinessManager(self, new_bm, old_bm): def compareBusinessManager(self, new_bm, old_bm):
""" """
Compare two business manager and return a new Business manager based on Compare two business manager and return a new Business manager based on
the difference. This is specially required to comapre two versions of the difference. This is specially required to compare two versions of
Business Manager(s). Business Manager(s).
""" """
compared_bm = new_bm-old_bm compared_bm = new_bm-old_bm
......
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