[Zope] Catalog import duplicates entries
08 Jun 2002 16:24:42 -0400
On Sat, 2002-06-08 at 14:14, John Schinnerer wrote:
> Makes sense, thanks - and seems like a CatalogAware bug vs.
> import/export functionality...and maybe vs. copy/cut/paste too.
Maybe.. To be honest, I think you'd need to look at the import/export
and cut/paste code to see how it works. It's a very scary beast, and
I'm not sure at all of the semantics of when things manage_afterAdd
methods are called during an import nor duing a cut and paste. I
usually just live with the results. ;-)
> 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...
I see. Well, then this might be a problem of the cut and paste
machinery not doing the right thing when the objects are moved. You
would expect that each object's manage_beforeDelete in the old place
would be called before being pasted into the new place, and that their
manage_afterAdds would be called as they are pasted into the new place.
The cut and paste code frightens me greatly, I try not to think about
> Larger question: if (no, *when* ;-) I rebuild my gallery objects using
> python products instead of ZClasses), how can I avoid this problem?
If you want things to catalog themselves when you add them,
manage_afterAdd is the most straightforward and "Zopish" way to do it.
Other solutions are possible, but you'd need to play around.
> And, how do I make the objects really catalog-smart, so they catalog
> themselves when created, recatalog themselves when edited, etc.?
Just call methods of the catalog manually. See
CatalogAware/CatalogPathAware for ideas on how to do it.