[ZCM] [ZC] 71/ 2 Reject "index_object and unindex_object default to virtual paths"

Collector: Zope Bugs and Patches ... zope-coders@zope.org
Fri, 15 Feb 2002 13:40:24 -0500


Issue #71 Update (Reject) "index_object and unindex_object default to virtual paths"
 Status Rejected, Zope/bug+solution medium
To followup, visit:
  http://collector.zope.org/Zope/71

==============================================================
= Reject - Entry #2 by evan on Feb 15, 2002 1:40 pm

 Status: Pending => Rejected

Use CatalogPathAwareness instead of CatalogAwareness.  I've added a note about CatalogAwareness' deprecation to the source.
________________________________________
= Request - Entry #1 by Anonymous User on Dec 6, 2001 12:13 pm

See http://www.zope.org/Members/rmore/unsuccessfulUncatalog for full details.


lib/python/Products/ZCatalog/CatalogAwareness.py includes index_object and unindex_object which utilize the object's url() method. When running under VirtualHostMonster (or anything which alters what url might return) calls to index_object or unindex_object operate on the virtual/relative path instead of the full path. 

On the other hand, when you ask a catalog to find and index it always uses the full/physical path.

When the paths don't match it results in an incorrect catalog.

The user symptom is seeing the unsuccessful unindex error message.

The following change for CatalogAwareness.py changes index_object and reindex_object to always use full paths and has solved the issue in my case:


    def index_object(self):
        """A common method to allow Findables to index themselves."""
        if hasattr(self, self.default_catalog):
            getattr(self, self.default_catalog).catalog_object(self, '/'.join(self.getPhysicalPath()))

    def unindex_object(self):
        """A common method to allow Findables to unindex themselves."""
        if hasattr(self, self.default_catalog):
            getattr(self, self.default_catalog).uncatalog_object('/'.join(self.getPhysicalPath()))



==============================================================