On Jul 23, 2008, at 7:06 AM, Ajay Deshpande wrote:

Hi all:

Ive been trying to cut objects from one context and paste them into another using a script python. But I get a "CopyError" when I try doing this. This is my code snippet and the traceback ...

Snippet...
...
obj = context.restrictedTraverse(path)
obj_parent = obj.aq_inner.aq_parent
dest_folder = context.Dest # this is a folder object
copy_info = obj_parent.manage_cutObjects((context.getId()))
dest_folder.manage_pasteObjects(copy_info)
...

I think the problem is your 4th line: copy_info = obj_parent.manage_cutObjects((context.getId()))
copy_info should be the object you want to cut

it should be something like this:
...
src=context.your_cut_context[obj_id]
context.your_cut_context.manage_cutObjects([src])

dst=context.your_paste_context
dst.manage_pasteObjects(src)
...

Let me know if it works for you,

Giampiero


_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to