[Zope] manage_pasteObjects question
David
bluepaul at earthlink.net
Thu Mar 9 00:44:00 EST 2006
Palermo, Tom wrote:
> Hi David,
>
> In my last post, I wrote that I tried calling manage_pasteObjects a
> variety of ways:
> context.manage_pasteObjects(context.REQUEST)
> context.manage_pasteObjects(context.cb_dataItems())
>
> as well as the original:
> context.manage_pasteObjects(cb_copy_data=context.cb_dataItems(),REQUEST=req['__cp'])
>
> All 3 of these attemps results in the eInvalid exception gettting
> raised by manage_pasteObjects( ). req['__cp'] is a reference to the
> cookie that gets set when you place something on the clipboard. I was
> trying to grab a specific piece of the REQUEST instead of the whole
> thing. Does context.manage_pasteObjects(context.REQUEST) need to be
> written as: context.manage_pasteObjects(REQUEST=context.REQUEST)?
>
> It's kind of a moot point now anyway. I'm using some SESSION variables
> now to store the ids of te objects I want to cut and the path of their
> container so I can do the cut and paste from a single script. Not sure
> if this is good or not but it's working for me now. It's one of those
> times when I just need something to work.
>
> -Tom
>
>
> ------------------------------------------------------------------------
> **
>
Hi Tom,
I'm glad you found 'another way' but in the interest of no one I wish to
add the following.
These methods: manage_copyObjects, manage_cutObjects and
manage_pasteObjects should be reviewed in /OFS/CopySupport.py - because
the current docs do not describe them well.
For example, the copy method works differently depending on whether you
just pass the container's Ids or pass the Ids *and* the REQUEST.
No reason to beat a dead horse but of the 3 tries you listed only the
first can (but conditionally) work:
context.manage_pasteObjects(context.REQUEST)
But *only* if you first called manage_copyObjects (or manage_cutObject)
with the REQUEST as a parameter included .... (only then does REQUEST
get the __cp object)
Your second try:
context.manage_pasteObjects(context.cb_dataItems())
Is wrong because it is passing a list of items in the clip board instead
of the the encoded copy object (returned by manage_copyObjects) that
"manage_pasteObjects" expects
Your last try is wrong because both parameters are incorrect. :-)
All best,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20060308/2af45c9f/attachment.htm
More information about the Zope
mailing list