[Zope] passing a zope <dtml-in...> list element to a sql method

Roger Mallett rogermallett at hotmail.com
Mon Sep 29 05:05:25 EDT 2003


Dieter, thank you for responding.

I made several attempts based on my understanding of your answer and I still 
am not getting it right.

Here is the situation as I last tried it:



"category", as passed to the form action, is a list generated by the user 
selecting multiple items from a listbox.

---------------------------------------------------
from my form:  (this part works fine)
---------------------------------------------------
    <tr><td><select name="category" size="10" multiple>
              <dtml-in sql_get_categories>
                  <option value="<dtml-var category>" > <dtml-var category>
              </dtml-in>


----------------------------
from my form action
----------------------------

      <dtml-in category prefix=test>  <dtml-comment>this is the 
list</dtml-comment>

      <dtml-call name="sql_delete_a_category(trash='<dtml-var test_item>')">
        <dtml-var test_item><br>  <dtml-comment>used to verify items are 
looping</dtml-comment>
      </dtml-in>


---------------------------------------
my SQL:  (nothing happens)
---------------------------------------
Arguments:  trash

delete from categories where category = '<dtml-var name="trash" sql_quote>'



What am I doing wrong?  My SQL returns with no error but doesn't delete the 
items I think I am passing.

Thank you for your continued help.
Roger Mallett




>From: Dieter Maurer <dieter at handshake.de>
>To: "Roger Mallett" <rogermallett at hotmail.com>
>CC: zope at zope.org
>Subject: Re: [Zope] passing a zope <dtml-in...> list element to a sql 
>method
>Date: Sun, 28 Sep 2003 22:31:17 +0200
>
>Roger Mallett wrote at 2003-9-28 05:33 +0000:
>  > I am attempting to access an element from a list and pass the element 
>to a
>  > SQL method.
>
>If "l" is a list, you access its "i"th element with "l[i]".
>
>To pass an argument to a Z SQL Method, you pass it as keyword
>argument:  "YourZSQLMethod(argument1=val1, argument2=val2,...)".
>
>
>Dieter

_________________________________________________________________





More information about the Zope mailing list