[Zope] Catalog import duplicates entries

John Schinnerer johnschinnerer@yahoo.com
Sat, 8 Jun 2002 11:14:57 -0700 (PDT)


Howdy,

> 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.

Makes sense, thanks - and seems like a CatalogAware bug vs.
import/export functionality...and maybe vs. copy/cut/paste too.

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

Don't know if this happens - what I'm importing has each item correctly
registered once; immediately after import, they're all registered
twice.  If they do it a third time when I cut/paste, I can't tell,
because in my situation the path would be identical to one already
cataloged; the total number of items in the Catalog is still only
double, not triple.

> 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.

I'm doing a cut/paste from the temporary container (not copy/paste), so
however that works internally, the catalog and objects cataloged are no
longer in the temp. container to visit...

Larger question:  if (no, *when* ;-) I rebuild my gallery objects using
python products instead of ZClasses), how can I avoid this problem?

And, how do I make the objects really catalog-smart, so they catalog
themselves when created, recatalog themselves when edited, etc.?

thanks,
John S.



__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com