[Zope] How to deal with the famous ZCatalog + SiteRoot bug?

Garikoitz Araolaza gari@eibar.org
Wed, 15 May 2002 17:02:07 +0200


The Zoper combining Catalogaware ZClasses and SiteRoot (or VHM) will 
quickly find the well known bug that makes object catalog themselves with 
the virtual path and not with the physical path.

I've found hundreds of Wikis and pages dealing with the problem and 
possible solutions, but the only place somebody suggests me an understable 
solution is in the Popoto installation documentation:

http://www.zope.org/Members/dgeorgieff/popoto/PopotoInstall

CORRECT A CatalogAware bug

CatalogAware Zclass have a small problem when working infront of Apache and 
a VirtualHostMonster.
You need to edit $HOMEZOPE/lib/python/Products/Zcatalog/CatalogAwareness.py 
and change url() (start ligne 152):
    ......
    def url(self, ftype=urllib.splittype, fhost=urllib.splithost):
       """Return a SCRIPT_NAME-based url for an object."""
       uri = string.join(self.getPhysicalPath(), "/")
       return urllib.unquote(uri)

    def summary(self, num=200):
    .....

After restarting Zope it works fine.

Should I directly replace 15 lines of code with that couple of lines? Why 
did the original programmer bother writing 15 when he could do it in 2 lines?

I promise to write a HOW-TO with the solution if I finally can fix the bug 
in my sites.

Thanks.  ;-)

Gari


_________________________________________________________
Aurki Euskara hutsezko bilatzailea
http://www.aurki.com
Zure laguntza behar dugu. Egin zaitez editore!