On Tue, Jan 16, 2007 at 12:24:01PM +0100, Thierry Florac wrote: > Le lundi 15 janvier 2007 à 16:36 +0100, Christian Theune a écrit : > > Am Montag, den 15.01.2007, 16:06 +0100 schrieb Thierry Florac: > > > In an application I'm currently building with Zope3, I need to be able > > > to "clone" several kinds of content data. > > > While cloning a simple content class is quite simple, I don't know > > > exactly how to clone data provided through adapters, which may store > > > these data throught annotations. ... > Thanks for this link ; in fact I already downloaded "zc.copy" but just > forgot to take a look at it... > > In fact, after looking at "zc.copy" package, I finally used the > "original" zope.copypastemove package function to duplicate my content > because it better feets my needs, without duplicating a set of > informations as zc.copy does but just keeping a link on them. > > The last problem I still have is that some of the informations stored > into object's annotations have to be indexed into a set of catalogs. > While these informations are indexed correctly when annotations are > created "by hand" in the "normal" way, it's not the case when content is > duplicated "in a whole". Any idea ? Should I iterate over object > annotations and check for ones that should contain indexable content ?
This is a murky part of Zope 3 that you've discovered. Generic object copying implementations can accidentally copy too much or too little, or fail to keep back-references synchronized. For example, beware of objects that provide ILocation but do not have their __parent__ set. You will need to provide adapters specific for your application that know what to copy, what not to copy, and what to index after copying. IIRC zc.copy is better for this kind of pluggability. You cannot really extend zope.copypastemove: if somebody decides to copy a folder that contains your application objects, these will get copied without looking for any specific adapters. Marius Gedminas -- "While preceding your entrance with a grenade is a good tactic in Quake, it can lead to problems if attempted at work." -- C Hacking
Description: Digital signature
_______________________________________________ Zope3-users mailing list Zope3email@example.com http://mail.zope.org/mailman/listinfo/zope3-users