Commit d9b70cb3 authored by Hanno Schlichting's avatar Hanno Schlichting

Emit a deprecation warning for ``Products.ZCatalog.CatalogAwareness``. The...

Emit a deprecation warning for ``Products.ZCatalog.CatalogAwareness``. The module was already deprecated according to its docstring. Since some five:deprecatedManageAddDelete directive in OFS always imports the module, we only emit the warning on actual use of the CatalogAware class.
parent 36545fb6
......@@ -35,6 +35,9 @@ Bugs Fixed
Restructuring
+++++++++++++
- Emit a deprecation warning for ``Products.ZCatalog.CatalogAwareness``. The
module was already deprecated according to its docstring.
- Removed deprecated ``catalog-getObject-raises`` zope.conf option.
- Removed unmaintained HelpSys documents from ZCatalog and PluginIndexes.
......
......@@ -15,7 +15,9 @@
**NOTE**: This module is deprecated, and should only be used for
backward-compatibility. All new code should use CatalogPathAwareness.
"""
import urllib
import warnings
from Acquisition import aq_base
from App.special_dtml import DTMLFile
......@@ -34,6 +36,12 @@ class CatalogAware:
manage_editCatalogerForm=DTMLFile('dtml/editCatalogerForm', globals())
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.',
DeprecationWarning, stacklevel=3)
def manage_editCataloger(self, default, REQUEST=None):
""" """
self.default_catalog=default
......@@ -41,7 +49,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():
......@@ -118,11 +125,13 @@ 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.url())
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.url())
......
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