[Zope] manage_cutObjects/manage_pasteObjects problem ...

Paul Winkler slinkp at gmail.com
Thu Jul 31 00:57:11 EDT 2008


Just a quick note:

On Fri, Jul 25, 2008 at 03:20:23PM +0200, Giampiero Benvenuti wrote:
> 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)

Sorry Giampiero, you're just guessing, and you're guessing wrong.  The
original poster's code was correct*.  Dieter's suggestion is a better
approach to troubleshoot this problem.


*well, almost correct. There's a common Python mistake on one line:

 copy_info = obj_parent.manage_cutObjects((context.getId()))
                                           ^^^^^^^^^^^^^^^^
You think you're creating a tuple there, but you're not.
To create a tuple of size 1, you need a trailing comma:

 copy_info = obj_parent.manage_cutObjects((context.getId(),))

But that's not causing your problem; manage_cutObjects() "helpfully"
wraps a string argument in a tuple for you.

-- 

Paul Winkler
http://www.slinkp.com


More information about the Zope mailing list