Re: [Zope3-Users] Content cloning ?
Le mardi 16 janvier 2007 à 07:27 -0500, Gary Poster a écrit : > On Jan 16, 2007, at 6:24 AM, Thierry Florac wrote: > > 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 isn't very clear to me, but if you fire the appropriate event > and you are using the default IKeyReference implementation then the > new copies should be indexed as different objects than the original, > as usual. Absolutely ! My difficulty is due to the fact that this duplication is done in a workflow context, which isn't aware of the different interfaces supported by the duplicated objects ; sometimes, it's a whole container which can be duplicated in a single operation, and so it's whole content have to be duplicated and indexed correctly... But workflow classes can't notify events for classes it's not directly aware of. Right ? Thierry Florac -- Chef de projet intranet/internet Office National des Forêts - Département Informatique 2, Avenue de Saint-Mandé 75570 PARIS Cedex 12 Mél : [EMAIL PROTECTED] Tél. : +33 01.40.19.59.64 Fax. : +33 01.40.19.59.85 ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Content cloning ?
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 signature.asc Description: Digital signature ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Content cloning ?
On Jan 16, 2007, at 6:24 AM, Thierry Florac wrote: 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. For the record, the point of zc.copy is that you can specify what is duplicated and what is linked. The decision is hardcoded in the zope.copypastemove code. Both use the same basic mechanism. Registering the adapters in zc.copy gives you the same behavior as zope.copypastemove, but then you can add more behavior (e.g., don't copy but link object X, reset counter y) for your copies. 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 isn't very clear to me, but if you fire the appropriate event and you are using the default IKeyReference implementation then the new copies should be indexed as different objects than the original, as usual. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Content cloning ?
Le lundi 15 janvier 2007 à 16:36 +0100, Christian Theune a écrit : > Am Montag, den 15.01.2007, 16:06 +0100 schrieb Thierry Florac: > > Hi, > > > > 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. > > > > What I was thinking about was something like : > > - create a new interface "IClonable", with a single "clone" method > > - make my specific content interfaces, eventually provided throught > > adapters, extend IClonable > > - get a list of interfaces provided by my content class, directly or > > throught adapters, which extend IClonable, and call their "clone" method > > when cloning is required. > > > > So, actually, my main problem is : > > - how can I get the list of interfaces provided by a given class, > > directly of throught adapters ? > > - is this conception method the best one in Python/Zope3 to clone > > data ?? > > > > Thanks for any help or advise... > > You might want to checkout zc.copy. Hi, 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 ? Thanks, Thierry Florac -- Chef de projet intranet/internet Office National des Forêts - Département Informatique 2, Avenue de Saint-Mandé 75570 PARIS Cedex 12 Mél : [EMAIL PROTECTED] Tél. : +33 01.40.19.59.64 Fax. : +33 01.40.19.59.85 ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Content cloning ?
Hi, Am Montag, den 15.01.2007, 16:06 +0100 schrieb Thierry Florac: > Hi, > > 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. > > What I was thinking about was something like : > - create a new interface "IClonable", with a single "clone" method > - make my specific content interfaces, eventually provided throught > adapters, extend IClonable > - get a list of interfaces provided by my content class, directly or > throught adapters, which extend IClonable, and call their "clone" method > when cloning is required. > > So, actually, my main problem is : > - how can I get the list of interfaces provided by a given class, > directly of throught adapters ? > - is this conception method the best one in Python/Zope3 to clone > data ?? > > Thanks for any help or advise... You might want to checkout zc.copy. Christian -- gocept gmbh & co. kg - forsterstraße 29 - 06112 halle/saale - germany www.gocept.com - [EMAIL PROTECTED] - phone +49 345 122 9889 7 - fax +49 345 122 9889 1 - zope and plone consulting and development signature.asc Description: Dies ist ein digital signierter Nachrichtenteil ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Content cloning ?
Hi, 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. What I was thinking about was something like : - create a new interface "IClonable", with a single "clone" method - make my specific content interfaces, eventually provided throught adapters, extend IClonable - get a list of interfaces provided by my content class, directly or throught adapters, which extend IClonable, and call their "clone" method when cloning is required. So, actually, my main problem is : - how can I get the list of interfaces provided by a given class, directly of throught adapters ? - is this conception method the best one in Python/Zope3 to clone data ?? Thanks for any help or advise... Thierry Florac -- Chef de projet intranet/internet Office National des Forêts - Département Informatique 2, Avenue de Saint-Mandé 75570 PARIS Cedex 12 Mél : [EMAIL PROTECTED] Tél. : +33 01.40.19.59.64 Fax. : +33 01.40.19.59.85 ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users