[Zope] RE: How to Delete ZClass Instances programmatically??

RC Compaan roche@up-front.co.za
Mon, 28 Aug 2000 15:43:12 +0200


Instead of directing your form to URL0 direct it back to your custom
interface.  In your form you can evaluate the value of submit to determine
the appropriate action:

 <dtml-if "REQUEST['submit'] == 'Delete'">
    <dtml-call "manage_delObjects(ids)">

untested.

Roché

> -----Original Message-----
> From: Jean Jordaan [mailto:Jean@mosaicsoftware.com]
> Sent: 28 August 2000 01:43
> To: 'zope@zope.org'
> Cc: RC Compaan (E-mail)
> Subject: How to Delete ZClass Instances programmatically??
>
>
> Hi Zopers
>
> I've found the "How-To: Adding ZClass Instances Programmatically",
> but now I'm looking for the *Deleting ZClass Instances* one!
>
> I'm trying this as a beginning (hacked from the Zope management
> interface)::
>
>     <dtml-if "AUTHENTICATED_USER.has_role('ContentManager')">
>       <form action="<dtml-var URL0>" method="post">
>     </dtml-if>
>   [...]
>     <dtml-if "AUTHENTICATED_USER.has_role('ContentManager')">
>       <input type="checkbox" name="ids:list" value="<dtml-var id>">
>     </dtml-if>
>   [...]
>     <dtml-if "AUTHENTICATED_USER.has_role('ContentManager')">
>       <input type="submit" name="manage_delObjects:method" value="Delete">
>       </form>
>     </dtml-if>
>
> Problems:
>
>  - it sends me to the management screen afterwards, and I'm
>    calling it from the public interface.
>
>  - I don't necessarily want to give the 'ContentManager' rights
>    to delete objects; I'd rather manage this through a delete
>    method with the appropriate proxy role.
>
> Any advice or RTFM pointers?
> --
> Jean Jordaan       --    technical writer    --
> Mosaic Software    --    Zope 2.1.6 on WinNT and W2K
>