[Zope] deleting documents

J Cameron Cooper jccooper at jcameroncooper.com
Fri Feb 20 17:23:21 EST 2004


garry saddington wrote:

>On Friday 20 February 2004 14:54, Small Business Services wrote:
>  
>
>><snip>
>>
>>>I have a DTML method which deletes a document from a folder, but
>>>everytime it
>>>
>>>does so it returns the user to the ZMI for that folder. How can i
>>>redirect it
>>>
>>>to show index_html instead of the folder contents for that folder. I am doing
>>>
>>>it this way because i can't work out a way to fire off a python script to do
>>>
>>>the same thing. The DTML method is below, can anyone help, either with
>>>the redirect or the script?
>>>
>>><dtml-in objectValues prefix="loop">
>>><dtml-if expr="loop_item==ctfxml">
>>><form>
>>>
>>><input type="checkbox"  name="ids:list" value="<dtml-var id>" checked/>
>>><dtml-var id>
>>>
>>><input type="submit" name="manage_delObjects:method" value="Delete">
>>></form>
>>></dtml-if>
>>></dtml-in>
>>>      
>>>
>> ...
>
>Thanks,your advice was spot on! I now have it working well. I would still like 
>to Know how python would cope with this if anyone knows?
>
A Python script like this::

special_delObjects(ids):
  context.manage_delObjects(ids)
  return context.index_html()

should do it. It could also end in::

  context.REQUEST.RESPONSE.redirect('./index_html')

       --jcc

-- 
"He who fights with monsters should look to it that he himself does not become a monster. And when you gaze long into an abyss the abyss also gazes into you."




More information about the Zope mailing list