[Zope-dev] bug in manage_pasteObjects ??

Dieter Maurer dieter at handshake.de
Fri Aug 29 20:05:58 EDT 2003


Romain Slootmaekers wrote at 2003-8-28 22:14 +0200:
 > after an object is copied & paste, the following method is called:
 > 
 > 
 > def manage_afterClone(self, item):
 >      """
 >      """
 > 
 > 
 > 
 > 
 > as it happens, both self and item refer to the same object.... which 
 > severely limits the use of the method. You probably want a reference to 
 > the original object from which this one was cloned.

I am not so sure about this.

I think, in most use cases, it is sufficient to have the copied
object. At least for all currently handled use cases it is apparently
sufficient.
What use case do you have that needs the original object?


Under no circumstances are you allowed to redefine the "item"
parameter above to refer to the original object (as suggested in
the quoted message):

  "manage_clone" is often implemented recursively and
  while in the top call "self" and "item" are identical,
  this changes in recursive calls.

  Knowing "item" (where the recursive "manage_clone" started)
  is essential to differentiate actions depending on the
  relative position of "item" with respect to other objects:

  e.g. initialize workflow when "item" is below the portal
  but do not when it is above.

  Code that makes these checks will break when you pass a differnt
  object as "item".



Dieter



More information about the Zope-Dev mailing list