-----BEGIN PGP SIGNED MESSAGE-----
Gaute Amundsen wrote:
> On Monday 28 August 2006 12:21, Andreas Jung wrote:
>> --On 28. August 2006 12:08:16 +0200 Gaute Amundsen <[EMAIL PROTECTED]> wrote:
>>> I am having some strange problems getting copy and paste to work
>>> propperly in python script
>>> Basically I do:
>>> parent.manage_copyObjects([currFold.id], REQUEST)
>>> in one script, and:
>> You must check the APIs carefully. manage_pasteObjects()
>> takes REQUEST as keyword parameter but not as positional
>> parameter. So you must pass is it as keyword parameter!
> So you are saying that
> parent.manage_copyObjects([currFold.id], REQUEST)
> is ok. and
> should be ok?
> When you mention it, where exactly is the APIs?
> A search of the zope site for "manage_copyObjects" givs me two largely
> irrelevant hits.
> Looking at this for example:
> ( which is one of the first things google throws up )
> gives no indication that REQUEST is a keyword parameter.
I think the keyword argument bit is a red herring. The issue here is
that the methods you are calling are not really designed to be scripted
within the context of a single request: 'manage_copyObjects' sets a
cookie in the *response* object, while 'manage_pasteObjects' looks for
that cookie in the *request* object. This works fine when used as
designed: the cookie from the response gets sent back in the next
request, which can then figure out which object(s) to paste.
For scripting, you need to capture the result of calling
'manage_copyObjects', which will be the value of the cookie (the
"clipboard data"), and then pass it into 'manage_pasteObjects'. E.g.::
cb_data = source.manage_copyObjects(ids=selected)
In this mode, you don't (and shouldn't) need to pass the request at all.
Tres Seaver +1 202-558-7113 [EMAIL PROTECTED]
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v188.8.131.52 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----
Zope maillist - Zope@zope.org
** No cross posts or HTML encoding! **
(Related lists -