[Zope-dev] Updating a ZCatalog when objects in it change their path

Chris Withers chrisw@nipltd.com
Sat, 30 Dec 2000 13:34:09 +0000


Squishdot uses ZCatalog quite heavily. When you move/copy/rename a
Squishdot site, all the Paths stored in its catalog become incorrect.
Not nice...

Darrick experienced this when copying a Squishdot site and then trying
to delete a load of articles. He didn't notice the uncatalog errors he
was getting when he did this and so reported that articles were still
showing up in searches after he'd deleted them. That's because the paths
stored didn't change when the site was moved and the delete code in
squishdot was trying to delete objects with a path at their new
location.

Rather than rant about the fact that paths are not unique identifiers
for objects in a ZODB (because they change when the objects move, and,
as this demonstrates, that's not good!) I thought I'd fix the problem.

However, the only way I could find to solve it was to add a
manage_afterAdd method to Squishdot Sites which recatalogued all
postings. This is a _lot_ more resource intensive than it needs to be,
since I don't actually want to recatalog all postings (quite expensive
when there are 3000+ of them ;-), I just want to modify the paths that
ZCatalog has stored.

Is there any way to do this? There probably should be ;-)

cheers,

Chris