Commit d9658e93 authored by Aurel's avatar Aurel

when using force, update catalog if necessary

do no test with is as it sometimes failed with both same object


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@12931 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 72020c7a
...@@ -3952,8 +3952,11 @@ Business Template is a set of definitions, such as skins, portal types and categ ...@@ -3952,8 +3952,11 @@ Business Template is a set of definitions, such as skins, portal types and categ
Return if catalog will be updated or not by business template installation Return if catalog will be updated or not by business template installation
""" """
catalog_method = getattr(self, '_catalog_method_item', None) catalog_method = getattr(self, '_catalog_method_item', None)
if catalog_method is not None and self.getTemplateFormatVersion() == 1 \ default_catalog = self.getPortalObject().portal_catalog.getSQLCatalog()
and _getCatalogValue(self) is self.getPortalObject().portal_catalog.getSQLCatalog(): my_catalog = _getCatalogValue(self)
if default_catalog is not None and my_catalog is not None \
and catalog_method is not None and self.getTemplateFormatVersion() == 1:
if default_catalog.getId() == my_catalog.getId():
# It is needed to update the catalog only if the default SQLCatalog is modified. # It is needed to update the catalog only if the default SQLCatalog is modified.
for method_id in catalog_method._objects.keys(): for method_id in catalog_method._objects.keys():
if 'related' not in method_id: if 'related' not in method_id:
...@@ -4099,6 +4102,9 @@ Business Template is a set of definitions, such as skins, portal types and categ ...@@ -4099,6 +4102,9 @@ Business Template is a set of definitions, such as skins, portal types and categ
item.install(local_configuration, force=force, object_to_update=object_to_update, trashbin=trashbin) item.install(local_configuration, force=force, object_to_update=object_to_update, trashbin=trashbin)
# update catalog if necessary # update catalog if necessary
if force and self.isCatalogUpdatable():
update_catalog = 1
else:
update_catalog = kw.get('update_catalog', 0) update_catalog = kw.get('update_catalog', 0)
if update_catalog: if update_catalog:
catalog = _getCatalogValue(self) catalog = _getCatalogValue(self)
......
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