[Zope] dtml call for copying items?

Michel Pelletier michel@digicool.com
Sun, 10 Oct 1999 17:39:37 -0400


Joseph Santaniello wrote:
> 
> Hi Everyone,
> 
> I'm trying to get some dtml code to copy a folder a user selects from a
> form, but I can't get it to work. Here are some snippits:
> 
> from form:
> 
> <input type="radio" name="ids:list" value="...
> 
> from form processor:
> 
> <!--#call "manage_copyObjects(ids)"-->
> <!--#call "manage_pasteObjects()"-->
> <!-- stuff to change the new folder's name...
> 
> I don't get any error on the copy, but the paste says the clipboard is
> empty.

That's because the mechanism works based on cookies.  Since there is no
browser involved in your code, and no cookie in the original 'REQUEST',
pasteObjects say's there clipboard is 'empty'.

You would have to dig a bit in the source to find a way around this. 
Might just involve a combination of DTML calls, buit it might involve
some python hacks.

Wait.. there is a million to one chance this might work, but I haven't
tested it, I just dreamed it up:

<dtml-if paste_objects>
  <dtml-call "manage_pasteObjects()">
<dtml-else>
  <dtml-call "manage_copyObjects(ids)">
  <dtml-if QUERY_STRING>
    <dtml-call "RESPONSE.redirect(absolute_url() + '&paste_objects=')">
  <dtml-else>
    <dtml-call "RESPONSE.redirect(absolute_url() + '?paste_objects=')">
  </dtml-if>
</dtml-if>

You might need to play with it.

-Michel