Log message for revision 115303:
  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.
  

Changed:
  U   Zope/trunk/doc/CHANGES.rst
  U   Zope/trunk/src/Products/ZCatalog/CatalogAwareness.py

-=-
Modified: Zope/trunk/doc/CHANGES.rst
===================================================================
--- Zope/trunk/doc/CHANGES.rst  2010-08-01 10:00:30 UTC (rev 115302)
+++ Zope/trunk/doc/CHANGES.rst  2010-08-01 10:07:08 UTC (rev 115303)
@@ -35,6 +35,9 @@
 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.

Modified: Zope/trunk/src/Products/ZCatalog/CatalogAwareness.py
===================================================================
--- Zope/trunk/src/Products/ZCatalog/CatalogAwareness.py        2010-08-01 
10:00:30 UTC (rev 115302)
+++ Zope/trunk/src/Products/ZCatalog/CatalogAwareness.py        2010-08-01 
10:07:08 UTC (rev 115303)
@@ -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 @@
 
     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 @@
         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 @@
 
     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())
 

_______________________________________________
Zope-Checkins maillist  -  Zope-Checkins@zope.org
https://mail.zope.org/mailman/listinfo/zope-checkins

Reply via email to