Commit 233ca03f authored by Vincent Pelletier's avatar Vincent Pelletier

Add a check to determine if the modified SQLCatalog is the default one. if...

Add a check to determine if the modified SQLCatalog is the default one. if not, no need to trigger a reindex.
Fix a problem when checking for portal_catalog on object which container is at the root of the portal (for example, a document contained directly in a module).


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11915 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6f598fdc
...@@ -608,7 +608,7 @@ class ObjectTemplateItem(BaseTemplateItem): ...@@ -608,7 +608,7 @@ class ObjectTemplateItem(BaseTemplateItem):
continue continue
# If container's container is portal_catalog, # If container's container is portal_catalog,
# then automatically create the container. # then automatically create the container.
elif container_path[-2] == 'portal_catalog': elif len(container_path) > 1 and container_path[-2] == 'portal_catalog':
# The id match, but better double check with the meta type # The id match, but better double check with the meta type
# while avoiding the impact of systematic check # while avoiding the impact of systematic check
container_container = portal.unrestrictedTraverse(container_path[:-1]) container_container = portal.unrestrictedTraverse(container_path[:-1])
...@@ -4061,7 +4061,9 @@ Business Template is a set of definitions, such as skins, portal types and categ ...@@ -4061,7 +4061,9 @@ Business Template is a set of definitions, such as skins, portal types and categ
# update catalog if necessary # update catalog if necessary
update_catalog=0 update_catalog=0
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: if catalog_method is not None and self.getTemplateFormatVersion() == 1 \
and _getCatalogValue(self) is self.getPortalObject().portal_catalog.getSQLCatalog():
# It is needed to update the catalog only if the default SQLCatalog is modified.
for id in catalog_method._objects.keys(): for id in catalog_method._objects.keys():
if id in object_to_update.keys() or force: if id in object_to_update.keys() or force:
if not force: if not force:
......
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