[Zope] deleting documents

garry saddington garry at joydiv.fsnet.co.uk
Fri Feb 20 22:10:55 EST 2004


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>
>
> A few things I noticed:
>
> 1) you are going to get 1 form for each pass thru the dtml-in loop!? If
> this is what you want ok, but if you don't, try something like:
>
> <form>
>
> <dtml-in objectValues prefix="loop">
> <dtml-if expr="loop_item==ctfxml">
>
> <input type="checkbox"  name="ids:list" value="<dtml-var id>" checked/>
> <dtml-var id>
>
> </dtml-if>
> </dtml-in>
>
> <input type="submit" name="manage_delObjects:method" value="Delete">
> </form>
>
>
> 2)  Instead of having the submit call up manage_delObjects directly, have
> the form call a dtml method which does the delete and then displays
> something for the user.
>
> eg.
>
> <form action="DeleteStuff" method="POST">
> ...
> <input type="submit"  value="Delete">
>
>
>
> Then create a dtml method called 'DeleteStuff', which contains:
>
> <dtml-call "manage_delObjects(ids)">
> <dtml-var standard_html_header>
> Have a Nice Day!
> <dtml-var standard_html_footer>
>
>
> Note: if your user is not logged-in (ie. authenticated) you will have to
> set the proxy to 'Manager' for the DeleteStuff dtml method
>
> Warning - this is all untested, but should get you going in the right
> direction
>
> HTH
>
> Jonathan
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?
regards
garry




More information about the Zope mailing list