ZCatalog Find Items broken in ZOPE 2.1? (was Very important for CatalogWare zopists)
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 -----Ursprungliche Nachricht----- Von: Jason Spisak [mailto:jason@mtear.com] Gesendet: Freitag, 14. Januar 2000 18:42 An: Markus Strickler Cc: Brian Lloyd; zope-dev@zope.org Betreff: Re: AW: [Zope] Very important for CatalogWare zopists Marcus, Yeah! Now I know I'm not going crazy. :) I don't see any way right now that could cause just a "/" to be inserted using the ZClass generated code. Jason Markus Strickler writes:
I have similar problems with a ZClass I just created. Although I now have all the Class instances cataloged twice. One with the trailing slash one without. Maybe it's a common mistake in the ZClass DTML-Code. I'll try to investigate this.
Markus
-----Urspr|ngliche Nachricht----- Von: zope-admin@zope.org [mailto:zope-admin@zope.org]Im Auftrag von Brian Lloyd Gesendet: Freitag, 14. Januar 2000 20:13 An: 'Jason Spisak'; zope-dev@zope.org; zope@zope.org Betreff: RE: [Zope] Very important for CatalogWare zopists
I have submitted this to the Collector and it is major for people who have items in their ZODB that are Catalog aware.
To create the bug follow these steps:
1.Create a Catalog Aware ZClass 2.Create an instance of that class 3.Make sure it is indexed by looking in the Catalog "Catolaged items" tab 4.Notice that there is *no* slash in front of the indexed url: "MyFolder/myobject" 5.Now clear the Catalog 6.Go to the "Find Items to Catalog" 7.Select just your New ZClass meta type so it is quick 8.Click "Find" 9.Make sure it is indexed by looking in the Catalog "Catolaged items" tab 10. Oh no! It has a different url. A leading slash! "/MyFolder/myobject" 11. Click on the link. It's broken!
Hi Jason - these steps are equivalent to what is currently done on Zope.org (which is running on a checkout equivalent to 2.1.2), and this does not seem to be a problem there.
While I won't totally rule out the possibility of something in Zope, the fact that we don't see this behavior seems to suggest that there might be something going awry in your particular ZClasses. In particular, I'd look for some difference in the way that it registers itself with the catalog at the time that it is created versus when it is "found" by the catalog. The difference could be a difference in either behavior, state or environment (i.e. is the acquisition context, etc. the same in both cases when the "absolute_url" method gets called to generate the url for the catalog? Is there any custom code around this logic?).
The object constructor is a good place to start looking for this sort of thing - try to trace through the activity in the constructor versus what happens when the existing object is "found" by the catalog. If possible, try to see what the value of the url given to the catalog is what you expected it to be...
What this means is that if you have a lot of items in you Catalog don't ever ever ever use the "Find" machinery until Digital fixes this(It worked in 2.0.0 Final). You will end up not being able to edit/reindex your objects, and the links in your applications may not function.
I have not heard any other reports of a problem like this, so until we can verify that it is a Zope problem I think that this is a little strong. If other Zopistas can reproduce this I would certainly like to hear about it though.
Brian Lloyd brian@digicool.com Product Manager 540.371.6909 Digital Creations http://www.digicool.com
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
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
Did you follow the discussion about / and id in ZCatalog? I haven't checked whether the apply_path bug has been fixed in the cvs as well. Markus
-----Ursprüngliche Nachricht----- Von: smpitts@magellan.midsouth.rr.com [mailto:smpitts@magellan.midsouth.rr.com]Im Auftrag von Stephen Pitts Gesendet am: Mittwoch, 19. Januar 2000 03:59 An: Markus Strickler Cc: Jason Spisak; Brian Lloyd; zope-dev@zope.org; zope@zope.org Betreff: [Zope-dev] Re: [Zope] ZCatalog Find Items broken in ZOPE 2.1? FIXED!
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
participants (2)
-
Markus Strickler -
Stephen Pitts