[Zope-dev] [Fwd: CopySupport bug]

Casey Duncan cduncan@kaivo.com
Fri, 04 May 2001 08:20:09 -0600


Casey Duncan wrote:
> 
> There is a subtle bug in the CopySupport module that makes it impossible
> to copy and paste a folder that contains a ZCatalog with CatalogAware
> objects indexed in the catalog also in that folder. The reason is as
> follows, CopySupport calls a hookable method manage_afterClone (which is
> hooked by CatalogAware). It does so after a copy is made of the object
> but BEFORE the copy is mounted in the ZODB.
> 
> manage_afterClone in CatalogAware tries to reindex the object, and in
> doing so tries to derive its URL for use as the ZCatalog uid by calling
> absolute_url on the object. This fails of course because the object as
> yet has no URL because it is not mounted. The error reported is a
> KeyError on SERVER_URL.
> 
> To make a long story somewhat shorter, I have a simple patch for this,
> but there is still one more subtle bit of behavior to take note of:
> 
> When the ZCatalog is copied, all of its indexed data gets copied. Then
> the new copies of the objects index themselves. This means that the
> copied catalog has twice as many objects in it as the original. This
> bugged me at first, but it makes sense and I don't see any obvious
> solution that would be consistent.
> 
> For those interested, the patch is here:
> 
> http://classic.zope.org:8080/Collector/2205/view
> 

This didn't ssem to go through yesterday, so I am resending it.

-- 
| Casey Duncan
| Kaivo, Inc.
| cduncan@kaivo.com
`------------------>