[Zope] Re: catalog aware not working.. help

Sascha Welter zopelist at betabug.ch
Wed Mar 21 12:42:51 EDT 2007


(Wed, Mar 21, 2007 at 03:23:13PM +0100) Josef Meile
wrote/schrieb/egrapse:
> > Keep in mind that you really should be using CatalogPathAware not
> > CatalogAware, or you will run into trouble with absolute_url() and
> > virtual hosting.
> Does it make a difference? If you go to
> <Zope_home>/lib/python/Products/ZCatalog/CatalogPathAwareness.py
> 
> You will see that CatalogPathAwareness.CatalogPathAware is a subclass of 
> CatalogPathAwareness.CatalogAware with no code at all. I'm in deed using 
> CatalogAware as base class of a python product in a virtual hosting 
> environment and haven't noticed any problem.

I would assume that CatalogPathAwareness.CatalogAware and 
CatalogAwareness.CatalogAware aren't the same thing.

Also there is a note at the start of 
lib/python/Products/ZCatalog/CatalogAwareness.py :
"**NOTE**: This module is deprecated, and should only be used for
  backward-compatibility.  All new code should use CatalogPathAwareness."

Yes, I've experienced problems when basing objects only on
"CatalogAware": When http://localhost:8080/example_site and
http://www.example.org are really the same thing (one through virtual
hosting and rewriting) and when you reindex objects while being at
http://localhost:8080/example_site, then you will get surprising object
URLs in your catalog - pointing back to the site URL you used while
indexing.

Usually it's not much of a problem to change existing objects over to
CatalogPathAware.

It might work to use 
from Products.ZCatalog.CatalogPathAwareness import CatalogAware
- I don't know. But it's not the same as using "CatalogAware", which
usually stems from people following really old documentation and using
"CatalogPathAware would make it clear what's intended.

All this is probably documented somewhere.

Regards,

Sascha



More information about the Zope mailing list