Problem with Cut and Paste
Hi, First I'm sorry if this message was already received in this list, but I'm sure I've not received it to confirm, so I send it again, sorry for the inconvenience. I'm trying to modify OFS/dtml/main.dtml and OFS/CopySupport.py in order to create a shortcut button to cut an object and paste it in the parent object in one click, because I think this may save lots of boring clicks, at least for me. When I call the following method from the management interface (OFS/dtml/main.dtml) then I receive this error: "The data in the clipboard could not be read, possibly due to cookie data being truncated by your web browser. Try copying fewer objects." But when I call if from a PythonScript it works fine. My method, bound to a MoveUp button of my own: --CUT--- def manage_moveupObjects(self, ids=None, REQUEST=None): """Moves the selected objects to the parent objets (e.g. Folder)""" if ids is None and REQUEST is not None: return eNoItemsSpecified elif ids is None: raise ValueError, 'ids must be specified' if type(ids) is type(''): ids=[ids] if hasattr(self, 'aq_parent') and hasattr(self.aq_parent, 'manage_pasteObjects') : cb_copy_data = self.manage_cutObjects(ids, REQUEST) return self.aq_parent.manage_pasteObjects(cb_copy_data, REQUEST) ---CUT--- If I call self.aq_parent.manage_pasteObjects with None as the first parameter then it works fine from the management interface but not from a PythonScript: I receive a "No clipboard data found" error. Please could someone explain me what the problem is ? (I want it to work both from the management interface and from Python) Thanks in advance. Jerome Alet
First I'm sorry if this message was already received in this list, but I'm sure I've not received it to confirm, so I send it again, sorry for the inconvenience.
I'm trying to modify OFS/dtml/main.dtml and OFS/CopySupport.py in order to create a shortcut button to cut an object and paste it in the parent object in one click, because I think this may save lots of boring clicks, at least for me.
When I call the following method from the management interface (OFS/dtml/main.dtml) then I receive this error:
"The data in the clipboard could not be read, possibly due to cookie data being truncated by your web browser. Try copying fewer objects."]
Jerome - most Web browsers have a maximum limit to the amount of cookie data that they will preserve from a given site (usually around 4k as I recall, though this may vary from browser to browser). If you have a lot of cookies from this site already, your browser may be silently truncating the cookie data sent. You could check this by looking at the length of the data you get from manage_cutObjects as cb_copy_data. Hope this helps! Brian Lloyd brian@digicool.com Software Engineer 540.371.6909 Digital Creations www.digicool.com
On Tue, Jan 30, 2001 at 11:13:52AM -0500, Brian Lloyd wrote:
I'm trying to modify OFS/dtml/main.dtml and OFS/CopySupport.py in order to create a shortcut button to cut an object and paste it in the parent object in one click, because I think this may save lots of boring clicks, at least for me.
When I call the following method from the management interface (OFS/dtml/main.dtml) then I receive this error:
"The data in the clipboard could not be read, possibly due to cookie data being truncated by your web browser. Try copying fewer objects."]
Jerome - most Web browsers have a maximum limit to the amount of cookie data that they will preserve from a given site (usually around 4k as I recall, though this may vary from browser to browser). If you have a lot of cookies from this site already, your browser may be silently truncating the cookie data sent. You could check this by looking at the length of the data you get from manage_cutObjects as cb_copy_data.
I've done this modification on a fresh 2.3.0-final installation with no other products installed, on localhost, and no special content other than a folder and an index_html document to test my modifications. However I've tested what you suggested, after deleting my Netscape 4.75 cookies file under Linux (2.2.18 kernel), the problem remains. If I check the cb_copy_data length then it returns: 16765 under Netscape and 14xxx under Lynx With Lynx I've got the time to see a message saying "500: Internal Server Error" but then it disappears and the message about the cookie length appears. Please could you test my method and see if it works for you because I sincerely don't know why it doesn't work here ? Thanks in advance for your time. Jerome Alet
I've done this modification on a fresh 2.3.0-final installation with no other products installed, on localhost, and no special content other than a folder and an index_html document to test my modifications.
However I've tested what you suggested, after deleting my Netscape 4.75 cookies file under Linux (2.2.18 kernel), the problem remains.
If I check the cb_copy_data length then it returns:
16765 under Netscape and 14xxx under Lynx
This is your problem - Netscape allows a maximum of 4k of cookie data for a given site (and silently truncates the rest). Brian Lloyd brian@digicool.com Software Engineer 540.371.6909 Digital Creations http://www.digicool.com
Good evening, On Tue, Jan 30, 2001 at 02:24:50PM -0500, Brian Lloyd wrote:
I've done this modification on a fresh 2.3.0-final installation with no other products installed, on localhost, and no special content other than a folder and an index_html document to test my modifications.
However I've tested what you suggested, after deleting my Netscape 4.75 cookies file under Linux (2.2.18 kernel), the problem remains.
If I check the cb_copy_data length then it returns:
16765 under Netscape and 14xxx under Lynx
This is your problem - Netscape allows a maximum of 4k of cookie data for a given site (and silently truncates the rest).
I'm sorry but AFAIK there's nothing sending cookies to my browser from this installation. More than that, if I manually cut then paste the same object with the Cut and Paste buttons in the management interface it works perfectly, and in this situation the cookie data should be exactly the same, correct me if I'm wrong. As a reminder what I've done is the following: * modified OFS/dtml/main.dtml to include a new button * create a new method bound to this button which first calls manage_cutObjects() and then calls manage_PasteObjects() on the parent folder with the result of the cut as its parameter If I try my method on other objects the problem is the same, however manually doing the Cut and Paste always work fine. Unfortunately I can't test it on another Zope installation here, that's why I asked you to try my method if you've got the time. bye, Jerome Alet
Good evening again, On Tue, Jan 30, 2001 at 08:45:06PM +0100, Jerome Alet wrote:
On Tue, Jan 30, 2001 at 02:24:50PM -0500, Brian Lloyd wrote:
This is your problem - Netscape allows a maximum of 4k of cookie data for a given site (and silently truncates the rest).
I'm sorry but AFAIK there's nothing sending cookies to my browser from this installation. More than that, if I manually cut then paste the same object with the Cut and Paste buttons in the management interface it works perfectly, and in this situation the cookie data should be exactly the same, correct me if I'm wrong.
I think I've found where the problem comes from, it has nothing to do with browsers or cookies (or me) AFAICT. When manage_cutObjects() is called with REQUEST != None (i.e. when used from the management interface) then instead of the cut objects it returns the value returned by manage_main(), this explains why my cb_copy_data was bad. I've sligthly modified manage_cutObjects() to confirm that's the problem: I've added a fourth parameter called noredirect to this method, this parameter is a named one and defaults to 0, then at the end of this method, I've just done: if not noredirect : return self.manage_main(REQUEST) return cp Now it works fine both from my new management interface (Zope's modified one) and from python scripts, with a method which does essentially the following: cb_copy_data = self.manage_cutObjects(ids, REQUEST, noredirect = 1) return self.aq_parent.manage_pasteObjects(cb_copy_data, REQUEST) In other terms manage_cutObjects() wasn't designed to be immediately followed by a call to another method when used from the management interface. Not sure if this is a bug, however it seems this is a common problem in Zope manage_xxxx() methods. hoping this will help bye, Jerome Alet
I'm sorry but AFAIK there's nothing sending cookies to my browser from this installation. More than that, if I manually cut then paste the same object with the Cut and Paste buttons in the management interface it works perfectly, and in this situation the cookie data should be exactly the same, correct me if I'm wrong.
Make sure that you are *not* passing the REQUEST to manage_cutObjects in your custom method. If you pass the REQUEST, manage_cutObjects will assume that it is being called from a Web form and it will return html rather than the copy_data token. It looks like that is what is happening - when you call manage_pasteObjects you are probably passing it html rather than the copy data, which is why it is failing to unencode it. Brian Lloyd brian@digicool.com Software Engineer 540.371.6909 Digital Creations http://www.digicool.com
participants (2)
-
Brian Lloyd -
Jerome Alet