[Zope] Re: Solution for copy/paste Problem of June?

Grégoire Weber gregoire.weber@switzerland.org
Wed, 25 Sep 2002 13:09:34 +0200


I "solved" the problem for me inserting

   obj._getCopy(container) # obj is the original object to be copy&pasted

somewhere in my own code before manage_pasteObjects gets called.
I know, it's not a proper solution.

Is this a bug?

Greg

At 13:04 25.09.2002 +0200, I wrote:
>Hi George,
>Hi Dieter,
>
>I saw your post and Dieters answer to a manage_pasteObjects problem
>(AttributeError: 'None' object has no attribute 'getId').
>
>   George: http://lists.zope.org/pipermail/zope/2002-June/116340.html
>
>   Dieters: http://lists.zope.org/pipermail/zope/2002-June/116370.html
>
>Did you find a solution for that?
>
>I run into the same problem (Dieter: the solution to my former 
>problem we discussed now uncovered this one). The object in the
>clipboard is the self object ref of manage_afterAdd(self, item, container).
>I'd like to copy it from container and paste into another folderish object.
>
>What I found out (Zope 2.5.1 on Win2k):
>
>   Adding an additional ob._getCopy(self) without assigning the
>   return value to a variable lets disappear the exception.
>
>   Funny, eh?
>
>   <CODE module="CopySuport.py" line="151.." zope_version="2.5.1">
>    for ob in oblist:
>        if not ob.cb_isCopyable():
>            raise CopyError, eNotSupported % ob.getId()
>        try:    ob._notifyOfCopyTo(self, op=0)
>        except: raise CopyError, MessageDialog(
>            title='Copy Error',
>            message=sys.exc_info()[1],
>            action ='manage_main')
>
>        ob._getCopy(self) ####### adding this no exception will be rose=
 below #######
>        ob=ob._getCopy(self)
>        id=self._get_id(ob.getId()) ###### exception here normaly ######
>        ob._setId(id)
>        self._setObject(id, ob)
>        ob = self._getOb(id)
>        ob.manage_afterClone(ob)
>   </CODE>
>
>Greetings, Greg
>_____________________________________
>Grégoire Weber
>Rigistr. 31
>CH-8006 Zürich
>Switzerland
>phone:  +41-(0)1-361 66 11
>mobile: +41-(0)79-44 11 457
>mailto:gregoire.weber@switzerland.org