Commit 765b279f authored by Hanno Schlichting's avatar Hanno Schlichting

Fully deprecate both CatalogAwareness and CatalogPathAwareness. They are...

Fully deprecate both CatalogAwareness and CatalogPathAwareness. They are untested and unused. Event subscribers for zope.lifecycleevents are the way to go.
parent 1035b6bf
......@@ -35,8 +35,8 @@ Bugs Fixed
Restructuring
+++++++++++++
- Emit a deprecation warning for ``Products.ZCatalog.CatalogAwareness``. The
module was already deprecated according to its docstring.
- Deprecated the ``Products.ZCatalog.CatalogAwareness`` and
``CatalogPathAwareness`` modules.
- Removed deprecated ``catalog-getObject-raises`` zope.conf option.
......
......@@ -39,7 +39,8 @@ class CatalogAware:
def _warn_deprecated(self):
warnings.warn('The Products.ZCatalog.CatalogAwareness module is '
'deprecated and will be removed in Zope 2.14. Please '
'use the CatalogPathAwareness module instead.',
'use event subscribers for zope.lifecycle events to '
'automatically index and unindex your objects.',
DeprecationWarning, stacklevel=3)
def manage_editCataloger(self, default, REQUEST=None):
......
......@@ -13,6 +13,8 @@
"""ZCatalog Findable class
"""
import warnings
from Acquisition import aq_base
from App.special_dtml import DTMLFile
......@@ -30,6 +32,13 @@ class CatalogAware:
manage_editCatalogerForm=DTMLFile('dtml/editCatalogerForm', globals())
def _warn_deprecated(self):
warnings.warn('The Products.ZCatalog.CatalogPathAwareness module is '
'deprecated and will be removed in Zope 2.14. Please '
'use event subscribers for zope.lifecycle events to '
'automatically index and unindex your objects.',
DeprecationWarning, stacklevel=3)
def manage_editCataloger(self, default, REQUEST=None):
""" """
self.default_catalog=default
......@@ -37,7 +46,6 @@ class CatalogAware:
if REQUEST is not None:
return self.manage_main(self, REQUEST, manage_tabs_message=message)
def manage_afterAdd(self, item, container):
self.index_object()
for object in self.objectValues():
......@@ -100,12 +108,14 @@ class CatalogAware:
def index_object(self):
"""A common method to allow Findables to index themselves."""
self._warn_deprecated()
if hasattr(self, self.default_catalog):
getattr(self,
self.default_catalog).catalog_object(self, self.getPath())
def unindex_object(self):
"""A common method to allow Findables to unindex themselves."""
self._warn_deprecated()
if hasattr(self, self.default_catalog):
getattr(self,
self.default_catalog).uncatalog_object(self.getPath())
......
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