[ZCM] [ZC] 1739/ 5 Comment "ZCatalog's 'pghandler' argument breaks CMF."

Collector: Zope Bugs, Features, and Patches ... zope-coders-admin at zope.org
Mon Mar 28 04:44:38 EST 2005


Issue #1739 Update (Comment) "ZCatalog's 'pghandler' argument breaks CMF."
 Status Resolved, Zope/bug medium
To followup, visit:
  http://www.zope.org/Collectors/Zope/1739

==============================================================
= Comment - Entry #5 by ajung on Mar 28, 2005 4:44 am

Reopening this issue again since svn.zope.org isn't working properly at this time :-/
Here is the patch:

ajung at localhost:~/sandboxes/Zope/Zope: svn diff lib/python/Products/ZCatalog/
Index: lib/python/Products/ZCatalog/ZCatalog.py
===================================================================
--- lib/python/Products/ZCatalog/ZCatalog.py    (revision 29679)
+++ lib/python/Products/ZCatalog/ZCatalog.py    (working copy)
@@ -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()

________________________________________
= Resolve - Entry #4 by ajung on Mar 28, 2005 4:37 am

 Status: Accepted => Resolved


________________________________________
= Assign - Entry #3 by dreamcatcher on Mar 27, 2005 4:39 pm

 Supporters added: ajung; removed: dreamcatcher

Call manage_convertIndexes on a CMF portal_catalog (1.4 or 1.5).
________________________________________
= Assign - Entry #2 by ajung on Mar 27, 2005 11:06 am

 Supporters added: dreamcatcher; removed: ajung

How can I reproduce the failure?
________________________________________
= Request - Entry #1 by dreamcatcher on Mar 26, 2005 1:12 pm

 Status: Pending => Accepted

 Supporters added: ajung

The new 'pghandler' argument added to ZCatalog's 'catalog_object' must be reflected on CMF's CatalogTool, or change ZCatalog's call to account for the missing argument on the function. 

Trying to call 'manage_convertIndexes' on a CMF site borks with a TypeError 'unkown keyword argument pghandler'.
==============================================================



More information about the Zope-Collector-Monitor mailing list