[Zope] ZCatalog Find Items broken in ZOPE 2.1? FIXED!

Stephen Pitts smpitts@midsouth.rr.com
Tue, 18 Jan 2000 20:59:26 -0600


--liOOAslEiF7prFVr
Content-Type: text/plain; charset=us-ascii

On Sat, Jan 15, 2000 at 11:30:51PM +0100, Markus Strickler wrote:
> Hi!
> I investigated some more on the find problem and think that the Find Items
> option in ZCatalog is broken.
> Here is what I did:
> - Installed ZOPE 2.1.2 Win32 Release.
> - Created a ZCatalog as /Catalog
> - Created a DTML Document as /test
> - Selected DTML Document in the Find Items
> - ZOPE finds the test Document but displays its path as /test (the link
> leads to http://test)
> 
> *Ouch*
> 
> Markus
> 

I just got hit by this as well. The culprit is in line 536 of
lib/python/Products/ZCatalog/ZCatalog.py:

apply_func(ob, (apply_path+'/'+p))

If apply_path is null, then an extra '/' is prepended to p (the object's
path) for no apparent reason. A quick fix is to replace this with:

if apply_path:
	apply_func(ob, (apply_path+'/'+p))
else:
	apply_func(ob, p)

A patch to that effect is attached
-- 
Stephen Pitts
smpitts@midsouth.rr.com
webmaster - http://www.mschess.org

--liOOAslEiF7prFVr
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="zcatalog.patch"

--- ../Zope-2.1.2-src/lib/python/Products/ZCatalog/ZCatalog.py	Fri Nov  5 12:58:54 1999
+++ lib/python/Products/ZCatalog/ZCatalog.py	Tue Jan 18 20:51:07 2000
@@ -533,7 +533,10 @@
                 )
                 ):
                 if apply_func:
-                    apply_func(ob, (apply_path+'/'+p))
+                    if apply_path:
+                        apply_func(ob, (apply_path+'/'+p))
+                    else:
+                        apply_func(ob, p)
                 else:
                     add_result((p, ob))
                     dflag=0

--liOOAslEiF7prFVr--