[Zope] ZSQL update operations

Casey Duncan cduncan@kaivo.com
Mon, 12 Mar 2001 10:18:20 -0700


Lee Marzke wrote:
> 
> Hi,
> 
> I'm displaying a set of data from a ZSQL method.  The showStatus
> method below works just fine.  I would now like to have a link
> on each data item allowing an ZSQL update or delete operation.
> 
> Can this be done by passing args to the ZSQL method vai the
> URL?    I'm a beginner with Zope/ZSQL btw...
> 
> I am partly unsure when the ZSQL method should define a parameter
> ( for instance to pass something by a URL, does that variable need
>   to be a paramenter )
> 
> Thanks,
> 
> Lee Marzke <lmarzke@kns.com>
> 
> == statusALL  DTML method ==
> <dtml-in "objectValues('Folder')">
>   <dtml-var showStatus>
> </dtml-in>
> 
> The following method shows data where the revname column is equal
> == showStatus DTML Method ==
> <h3><!--#var title_or_id--></h3>
> <table width="80%" border=0 cellpadding=5 cellspacing=0>
> <tr><th>ID</th><th>Name</th><th>Begin</th><th>End</th><th>Status</th></tr>
> <!--#in "show_pending()" -->
>    <!--#if sequence-even -->
>      <tr bgcolor="#eeeeee">
>    <!--#else -->
>      <tr bgcolor="#ffffff">
>    <!--#/if -->
>       <td><!--#var requestid --></td>
>       <td><!--#var username --></td>
>       <td><!--#var starttime --></td>
>       <td><!--#var endtime --></td>
>       <td><!--#var comment --></td>
>       <td><a href="<!--#var "updateRequest.absolute_url()"-->">Update</a></td>
>   </tr>
> <!--#/in -->
> </table>
> 
> ===showPending()  ZSQL method ===
> SELECT requestid, revname, username, starttime, endtime, comment, status
> FROM tableR <!--#sqlgroup where-->
>   <!--#sqltest revname op=eq type=string -->
>   <!--#and -->
>   status = 0
> <!--#/sqlgroup-->
> 
> Lee Marzke <lmarzke@kns.com>             12-Mar-01, 10:58:07
> Kulicke & Soffa Industries
> 2101 Blair Mill Rd                       +1 215 784-6217
> Willow Grove, PA 19090                   +1 215 784-6014 fax
> 

Anything you want passed to your ZSQL method must be defined as an
argument. They come from the REQUEST object, so they can be passed
directly from a URL defined variable.

BTW:

The dtml syntax you are using <!--#blah--> has been deprecated in favor
of <dtml-blah>. I'm not sure if DC is intending on supporting the
deprecated syntaxes forever, so it might be a good idea to use the
favored syntax.

-- 
| Casey Duncan
| Kaivo, Inc.
| cduncan@kaivo.com
`------------------>