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

Grégoire Weber gregoire.weber@switzerland.org
Wed, 25 Sep 2002 03:25:00 +0200


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
mailto:gregoire.weber@switzerland.org