Problem with programmatic copy and paste
We are trying to copy the contents of one folder into another using DTML. The code below produces the following exception: 'One or more items referred to in the clipboard data was not found. The item may have been moved or deleted after you copied it.' <dtml-let clip="manage_copyObjects(objectIds())"> <dtml-with Folder> <dtml-with "_.getitem(REQUEST['id'])"> <dtml-call "manage_pasteObjects(clip)"> </dtml-with> </dtml-with> </dtml-let> This works (mostly) if the getitem call is removed, and the objects are pasted into 'Folder' - which is an instance of a ZClass, which subclasses folder. I have seen a similar question to this in the archives of this list but I have not found an answer. Can anyone help? Richard -- Richard Taylor (Senior Analyst) Information Systems Department (CIS3) DERA Malvern, Woodward Building, Room B106 The Information contained in this E-Mail and any subsequent correspondence is private and is intended solely for the intended recipient(s). For those other than the recipient any disclosure, copying, distribution, or any action taken or omitted to be taken in reliance on such information is prohibited and may be unlawful.
Richard Taylor wrote:
We are trying to copy the contents of one folder into another using DTML.
The code below produces the following exception: 'One or more items referred to in the clipboard data was not found. The item may have been moved or deleted after you copied it.'
<dtml-let clip="manage_copyObjects(objectIds())"> <dtml-with Folder> <dtml-with "_.getitem(REQUEST['id'])"> <dtml-call "manage_pasteObjects(clip)"> </dtml-with> </dtml-with> </dtml-let>
This works (mostly) if the getitem call is removed, and the objects are pasted into 'Folder' - which is an instance of a ZClass, which subclasses folder.
I have seen a similar question to this in the archives of this list but I have not found an answer.
Can anyone help?
The problem is that the entire cut and paste mechanism is based on cookies. The best workaround I can think of is to do a copy and then redirect to a method that does the past. Perhaps you can add the need for a DTML and python level cut and past interface to the Interfaces Wiki? http://www.zope.org/Members/michel/Projects/Interfaces -Michel
Actually the copy and paste mechanism should work through Python calls. I don't see why it wouldn't work from DTML. manage_cutObjects and manage_copyObjects return the same value that is placed into the cookie. In theory you should be able to pass this value into the manage_pasteObjects method. Have you tried it from an external method instead of DTML? -jfarr ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Hi! I'm a signature virus. Copy me into your .sig to join the fun! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ----- Original Message ----- From: Michel Pelletier <michel@digicool.com> To: <R.Taylor@eris.dera.gov.uk> Cc: <zope-dev@zope.org> Sent: Tuesday, April 04, 2000 10:48 AM Subject: Re: [Zope-dev] Problem with programmatic copy and paste
Richard Taylor wrote:
We are trying to copy the contents of one folder into another using DTML.
The code below produces the following exception: 'One or more items referred to in the clipboard data was not found.
The item
may have been moved or deleted after you copied it.'
<dtml-let clip="manage_copyObjects(objectIds())"> <dtml-with Folder> <dtml-with "_.getitem(REQUEST['id'])"> <dtml-call "manage_pasteObjects(clip)"> </dtml-with> </dtml-with> </dtml-let>
This works (mostly) if the getitem call is removed, and the objects are
pasted
into 'Folder' - which is an instance of a ZClass, which subclasses folder.
I have seen a similar question to this in the archives of this list but I have not found an answer.
Can anyone help?
The problem is that the entire cut and paste mechanism is based on cookies. The best workaround I can think of is to do a copy and then redirect to a method that does the past.
Perhaps you can add the need for a DTML and python level cut and past interface to the Interfaces Wiki?
http://www.zope.org/Members/michel/Projects/Interfaces
-Michel
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
participants (3)
-
Jonothan Farr -
Michel Pelletier -
Richard Taylor