[Zope-dev] manage_pasteObjects and REQUEST

Danny William Adair danny@adair.net
Tue, 14 Aug 2001 09:13:37 +1200


Hi!

Does anyone know when manage_PasteObjects will stop requiring REQUEST to be 
passed? I want to mimick the Cut/Copy/Paste Support of the management 
interface in a UI of my own.

my method "objectsCut" holds:
<dtml-call "manage_cutObjects(REQUEST['ids'], REQUEST)">

while my "objectsPaste" method holds:
<dtml-call "manage_pasteObjects(_.None, REQUEST)">

Pasting objects will sometimes (!?!) redirect me to the management 
interface, which I want to hide.
I found these last lines in manage_pasteObjects (CopySupport.py):

     def manage_pasteObjects(self, cb_copy_data=None, REQUEST=None):
         """Paste previously copied objects into the current object.
            If calling manage_pasteObjects from python code, pass
            the result of a previous call to manage_cutObjects or
            manage_copyObjects as the first argument."""
     ...
     ...
     ...
             if REQUEST is not None:
                 REQUEST['RESPONSE'].setCookie('__cp', 'deleted',
                                     path='%s' % cookie_path(REQUEST),
                                     expires='Wed, 31-Dec-97 23:59:59 GMT')
                 REQUEST['__cp'] = None
                 return self.manage_main(self, REQUEST, update_menu=1,
                                         cb_dataValid=0)

I don't want to hack this file.
The only way to get the cookie set seems to be passing the REQUEST object.

"...pass the result of a previous call to manage_cutObjects or 
manage_copyObjects as the first argument"

This doesn't help me very much. It would help me if I wanted to Copy/Paste 
or Cut/Paste at the same time:

<dtml-call "REQUEST.set('my_clipboard_data', 
manage_cutObjects(REQUEST['ids'], REQUEST))">
<dtml-call "manage_pasteObjects(my_clipboard_data)">

works fine, but if I want to do Copy and Paste at completely different 
times, I have to pass my_clipboard_data along the requests all the time.

Is there a simple solution? Is it something I should put in the Bug 
Collector? Or did I miss something?

Thank you very much for your help,

Danny