RE: [Zope] manage_pasteObjects question
Hi David, I reviewed OFS.CopySupport.py which is how I knew that eInvalid exception is being raised. I also called manage_cutObjects with the REQUEST as you mention. That's what is weird about this whole thing. I know that I had clipboard data and the __cp cookie is set. Everytime I tried to do the paste, I'd get the "cookie truncated" message. You're right about the documentation. As with most Zope documentation, it's not that great. Lately, I go straight to the source. I find I learn more that way. Thanks, Tom From: David [mailto:[EMAIL PROTECTED] Sent: Thursday, March 09, 2006 12:44 AMTo: Palermo, TomCc: 'zope@zope.org'Subject: Re: [Zope] manage_pasteObjects question 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" expectsYour last try is wrong because both parameters are incorrect. :-)All best,David ___ 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 )
Re: [Zope] manage_pasteObjects question
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 ___ 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 )
RE: [Zope] manage_pasteObjects question
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 From: David [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 08, 2006 6:12 PMTo: Palermo, TomCc: 'Dieter Maurer'; 'zope@zope.org'Subject: Re: [Zope] manage_pasteObjects question Palermo, Tom wrote: I'm trying to do the cut in one script and the paste in another script. It's my understanding that REQUEST is an optional parameter to manage_cutObjects(). Passing REQUEST will set a cookie, __cp. __cp is the clipboard data. Later when I try to do manage_pasteObjects() from another script, I always get a "cookie data is truncated" message regardless of how I try to pass in the clipboard data. I should be able to just do: context.manage_pasteObjects(context.cb_dataItems()) That doesn't work. I still get the "cookie data is truncated" message. I get the same message if I do: context.manage_pasteObjects(context.REQUEST) I know that there are, in fact, objects on the clipboard because I can just do: print context.cb_dataItems() return printed I'm not sure what I'm doing wrong. It seems like you can have cut and paste happen in separate scripts. Is that not true? Thanks, Tom -Original Message- From: Dieter Maurer [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 08, 2006 2:07 PM To: Palermo, Tom Cc: 'zope@zope.org' Subject: Re: [Zope] manage_pasteObjects question Palermo, Tom wrote at 2006-3-7 16:13 -0500: I am trying to do a manage_cutObjects in one script and then a manage_pasteObjects. Usually, this looks like: obj_info = XXX.manage_cutObjects(...) YYY.manage_pasteObjects(obj_info) When I execute this line from my pasteObjects python script: context.manage_pasteObjects(cb_copy_data=context.cb_dataItems(),REQUEST =req[ '__cp']) Do not know, why in hell you pass in a crippled request... You should be aware that "req['__cp']" is not a request object... -- Dieter __Tom,You didnt respond to Dieter's remarks so its unclear where to go with this.You coded: context.manage_pasteObjects(cb_copy_data=context.cb_dataItems(),REQUEST=req['__cp'])What is the last parameter doing? REQUEST=req['__cp'] ? The manage_pastObjects expects a REQUEST object, e.g. REQUEST=context.REQUEST.Did you try this? David ___ 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 )
Re: [Zope] manage_pasteObjects question
Palermo, Tom wrote: I'm trying to do the cut in one script and the paste in another script. It's my understanding that REQUEST is an optional parameter to manage_cutObjects(). Passing REQUEST will set a cookie, __cp. __cp is the clipboard data. Later when I try to do manage_pasteObjects() from another script, I always get a "cookie data is truncated" message regardless of how I try to pass in the clipboard data. I should be able to just do: context.manage_pasteObjects(context.cb_dataItems()) That doesn't work. I still get the "cookie data is truncated" message. I get the same message if I do: context.manage_pasteObjects(context.REQUEST) I know that there are, in fact, objects on the clipboard because I can just do: print context.cb_dataItems() return printed I'm not sure what I'm doing wrong. It seems like you can have cut and paste happen in separate scripts. Is that not true? Thanks, Tom -Original Message- From: Dieter Maurer [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 08, 2006 2:07 PM To: Palermo, Tom Cc: 'zope@zope.org' Subject: Re: [Zope] manage_pasteObjects question Palermo, Tom wrote at 2006-3-7 16:13 -0500: I am trying to do a manage_cutObjects in one script and then a manage_pasteObjects. Usually, this looks like: obj_info = XXX.manage_cutObjects(...) YYY.manage_pasteObjects(obj_info) When I execute this line from my pasteObjects python script: context.manage_pasteObjects(cb_copy_data=context.cb_dataItems(),REQUEST =req[ '__cp']) Do not know, why in hell you pass in a crippled request... You should be aware that "req['__cp']" is not a request object... -- Dieter __ Tom, You didnt respond to Dieter's remarks so its unclear where to go with this. You coded: context.manage_pasteObjects(cb_copy_data=context.cb_dataItems(),REQUEST=req['__cp']) What is the last parameter doing? REQUEST=req['__cp'] ? The manage_pastObjects expects a REQUEST object, e.g. REQUEST=context.REQUEST. Did you try this? David ___ 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 )
RE: [Zope] manage_pasteObjects question
I'm trying to do the cut in one script and the paste in another script. It's my understanding that REQUEST is an optional parameter to manage_cutObjects(). Passing REQUEST will set a cookie, __cp. __cp is the clipboard data. Later when I try to do manage_pasteObjects() from another script, I always get a "cookie data is truncated" message regardless of how I try to pass in the clipboard data. I should be able to just do: context.manage_pasteObjects(context.cb_dataItems()) That doesn't work. I still get the "cookie data is truncated" message. I get the same message if I do: context.manage_pasteObjects(context.REQUEST) I know that there are, in fact, objects on the clipboard because I can just do: print context.cb_dataItems() return printed I'm not sure what I'm doing wrong. It seems like you can have cut and paste happen in separate scripts. Is that not true? Thanks, Tom -Original Message- From: Dieter Maurer [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 08, 2006 2:07 PM To: Palermo, Tom Cc: 'zope@zope.org' Subject: Re: [Zope] manage_pasteObjects question Palermo, Tom wrote at 2006-3-7 16:13 -0500: >I am trying to do a manage_cutObjects in one script and then a >manage_pasteObjects. Usually, this looks like: obj_info = XXX.manage_cutObjects(...) YYY.manage_pasteObjects(obj_info) >When I execute this line from my pasteObjects python >script: >context.manage_pasteObjects(cb_copy_data=context.cb_dataItems(),REQUEST >=req[ >'__cp']) Do not know, why in hell you pass in a crippled request... You should be aware that "req['__cp']" is not a request object... -- Dieter ___ 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 )
Re: [Zope] manage_pasteObjects question
Palermo, Tom wrote at 2006-3-7 16:13 -0500: >I am trying to do a manage_cutObjects in one script and then a >manage_pasteObjects. Usually, this looks like: obj_info = XXX.manage_cutObjects(...) YYY.manage_pasteObjects(obj_info) >When I execute this line from my pasteObjects python >script: >context.manage_pasteObjects(cb_copy_data=context.cb_dataItems(),REQUEST=req[ >'__cp']) Do not know, why in hell you pass in a crippled request... You should be aware that "req['__cp']" is not a request object... -- Dieter ___ 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 )
[Zope] manage_pasteObjects question
I am trying to do a manage_cutObjects in one script and then a manage_pasteObjects. When I execute this line from my pasteObjects python script: context.manage_pasteObjects(cb_copy_data=context.cb_dataItems(),REQUEST=req['__cp']) I get a message back: "The data in the clipboard could not be read, possibly due to cookie data being truncated by your web browser. Try copying fewer objects." I'm not sure why this happens. This doesn't happen from the ZMI so it's something to do with how I'm calling context.manage_pasteObjects in the above snippet. I also had my pasteObjects script return the clipboard data: print context.cb_dataItems() return printed which returns: [] So, I know I've got clipboard data but for some reason, manage_pasteObjects thinks I don't and raises eInvalid on line 143 of OFS.CopySupport.py. Any ideas? Thanks, Tom Palermo Senior Web Developer Constella Group, LLC ___ 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 )