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