Commit d1c02864 authored by Julien Muchembled's avatar Julien Muchembled

Fix retrieval of catalog tool for unwrapped objects

This reverts 39157 & 39184 partially.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@39215 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0a89e89e
...@@ -360,8 +360,11 @@ class CopyContainer: ...@@ -360,8 +360,11 @@ class CopyContainer:
Unindex the object from the portal catalog. Unindex the object from the portal catalog.
""" """
if self.isIndexable: if self.isIndexable:
catalog = getattr(self.getPortalObject(), 'portal_catalog', None) try:
if catalog is not None: catalog = self.getPortalObject().portal_catalog
except AttributeError:
pass
else:
# Make sure there is not activity for this object # Make sure there is not activity for this object
self.flushActivity(invoke=0) self.flushActivity(invoke=0)
uid = getattr(self,'uid',None) uid = getattr(self,'uid',None)
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
from Products.CMFCore.CMFCatalogAware import CMFCatalogAware from Products.CMFCore.CMFCatalogAware import CMFCatalogAware
from Acquisition import aq_base from Acquisition import aq_base
from Products.CMFCore.utils import getToolByName
def reindexObject(self, idxs=[], *args, **kw): def reindexObject(self, idxs=[], *args, **kw):
""" """
...@@ -30,7 +31,7 @@ def reindexObject(self, idxs=[], *args, **kw): ...@@ -30,7 +31,7 @@ def reindexObject(self, idxs=[], *args, **kw):
# Update the modification date. # Update the modification date.
if getattr(aq_base(self), 'notifyModified', None) is not None: if getattr(aq_base(self), 'notifyModified', None) is not None:
self.notifyModified() self.notifyModified()
catalog = getattr(self.getPortalObject(), 'portal_catalog', None) catalog = getToolByName(self, 'portal_catalog', None)
if catalog is not None: if catalog is not None:
catalog.reindexObject(self, idxs=idxs, *args, **kw) catalog.reindexObject(self, idxs=idxs, *args, **kw)
......
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