[Zope] Catalog import duplicates entries - more info

Chris McDonough chrism@zope.com
Thu, 6 Jun 2002 18:15:47 -0400


This is due to CatalogAware's penchant for cataloging itself when an object
that subclasses it is added to a place.

A CatalogAware object defines a method named "manage_afterAdd" that finds a
catalog and catalogs itself.

Evidently this method is called at import time for each of your CatalogAware
objects.  So when you import the "temporary" container, the subobjects of
the temporary container register themselves with the catalog.

Then when you copy the container (or the container's subobjects), they
register themselves again in the new place.

You might try visiting the "temporary" container and doing "Select All" and
delete to see if it clears up the duplicate entries before actually deleting
the container.

----- Original Message -----
From: "John Schinnerer" <johnschinnerer@yahoo.com>
To: "zope list" <zope@zope.org>
Sent: Thursday, June 06, 2002 4:51 PM
Subject: Re: [Zope] Catalog import duplicates entries - more info


> Hello,
>
> The double-cataloging happens when I do the import of the folder
> containing the new site, after deleting the old objects.
>
> That is, if I go look at the catalog in the imported folder right after
> importing it, everything is already doubled (before the cut and paste
> into the root).
>
> --- Chris McDonough <chrism@zope.com> wrote:
> > Are the paths that show up in the Catalog "Catalog" view of the
> > duplicated objects the same as the paths of the non-duplicate
> > objects?
>
> No - looks like each object is being 'found' twice, via a different
> path.  One path starts from the root (and includes the imported
> folder); one starts from the imported folder - like this:
>
> /root/imported_folder/gallery/gallery_items/item123
> ...and...
> /imported_folder/gallery/gallery_items/item123
>
> Does that shed light?
>
> > Are the objects smart enough to decatalog themselves on deletion
> > (e.g. are they "CatalogAware" or "CatalogPathAware"?)
>
> They're built with ZClasses (never again! ;-) and use CatalogAware.  I
> haven't deleted any objects so far, only added them.
>
> What I have been doing is deleting the records(?) in the catalog tab,
> via ZMI, to clear the duplicates...thus my question about a select all
> button on that form...
>
> thanks,
> John S.
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! - Official partner of 2002 FIFA World Cup
> http://fifaworldcup.yahoo.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 )
>