[Zope] Delete multiple posts
Gitte Wange
gitte@babytux.dk
03 Apr 2001 17:54:07 +0200
On 03 Apr 2001 08:49:14 -0600, Casey Duncan wrote:
> Gitte Wange wrote:
> >
> >
> > well I made the list: NAME="ids:list" in the checkbox line
> > When you hit the deletebutton a method is called.
> > The code for deletion is here:
> > <dtml-in ids>
> > <dtml-call sqlDeleteClips> <-- That's the sqlmethod
> > </dtml-in>
> >
> > What's funny is that I get an 400 error.
> > And I have 3 hidden fiels in the same form - normally they would be
> > passed as ActionList=1 etc. etc. but now they are passed as
> > ActionList=['1', '1', '1', '1', '1', '1', '1', '1']
> >
> > Yes I know I should learn some python but I'm working against time :-)
> >
> > Gitte
>
> Thought I would jump in:
>
> You do not need to explicitly iterate the list in dtml. You can simply
> pass the list whole to the ZSQL method and delete all the items in one
> SQL call. This will be much more efficient both in code and overhead.
> The ZSQL method would be something like:
>
> Arguments:
> ids:list
>
> Code:
> DELETE FROM mytable WHERE <dtml-sqltest name="ids" column="id"
> type="int" multiple>
>
> If you pass is a list like [2,4,6,8] the resulting SQL will look like:
>
> DELETE FROM mytable WHERE id in (2,4,6,8)
>
> hth,
> --
> | Casey Duncan
> | Kaivo, Inc.
> | cduncan@kaivo.com
> `------------------>
Well that helped a little.
I set the Form ACTION-tag to sqlDeleteClips (which is my sql method) and
the checkbox name to "ids:list"
When I hit the submit button, you see a Zope page where there is a input
box to enter the ids in .. but I just want it do delete the ones that
are selected ???
--
************************
Gitte Wange Jensen
System Squid Developer
MMManager Aps
+45 29 72 79 72
gitte@mmmanager.org
************************