[Zope-Checkins] SVN: Zope/trunk/lib/python/Products/ZCatalog/ZCatalog.py

Andreas Jung andreas at andreas-jung.com
Mon Mar 28 10:50:25 EST 2005


Log message for revision 29693:
  

Changed:
  U   Zope/trunk/lib/python/Products/ZCatalog/ZCatalog.py

-=-
Modified: Zope/trunk/lib/python/Products/ZCatalog/ZCatalog.py
===================================================================
--- Zope/trunk/lib/python/Products/ZCatalog/ZCatalog.py	2005-03-27 18:39:17 UTC (rev 29692)
+++ Zope/trunk/lib/python/Products/ZCatalog/ZCatalog.py	2005-03-28 15:50:25 UTC (rev 29693)
@@ -15,6 +15,7 @@
 $Id$
 """
 
+from warnings import warn
 import urllib, time, sys, string,logging
 
 from Globals import DTMLFile, MessageDialog
@@ -501,11 +502,18 @@
                     # products like CMF 1.4.2 and earlier that subclass from
                     # ZCatalog and don't support the update_metadata argument.
                     # May be removed some day.
-                    from warnings import warn
                     warn('catalog_object interface of %s not up to date'
                          % self.__class__.__name__,
                          DeprecationWarning)
-                    self.catalog_object(obj, p, idxs=name, pghandler=pghandler)
+                    try:
+                        self.catalog_object(obj, p, idxs=name, pghandler=pghandler)
+                    except TypeError:
+                        # Fall back to pre-Zope 2.8 interface where there is no
+                        # 'pghandler' argument.
+                        warn('catalog_object interface of %s not up to date'
+                             % self.__class__.__name__,
+                             DeprecationWarning)
+                        self.catalog_object(obj, p, idxs=name)
 
         if pghandler:
             pghandler.finish()



More information about the Zope-Checkins mailing list