[Zope] Problem with Cut and Paste

2001-01-30 Thread Jerome Alet

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

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




RE: [Zope] Problem with Cut and Paste

2001-01-30 Thread Brian Lloyd

 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[EMAIL PROTECTED]
Software Engineer  540.371.6909
Digital Creations  www.digicool.com


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] Problem with Cut and Paste

2001-01-30 Thread Jerome Alet

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


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




RE: [Zope] Problem with Cut and Paste

2001-01-30 Thread Brian Lloyd

 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[EMAIL PROTECTED]
Software Engineer  540.371.6909  
Digital Creations  http://www.digicool.com 



___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




RE: [Zope] Problem with Cut and Paste

2001-01-30 Thread Brian Lloyd

 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[EMAIL PROTECTED]
Software Engineer  540.371.6909  
Digital Creations  http://www.digicool.com 




___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




[Zope] BUG? was Re: [Zope] Problem with Cut and Paste

2001-01-30 Thread 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_() methods.

hoping this will help

bye,

Jerome Alet



___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )