[Zope] embed an SQL method inside a <dtml-in> tag

jpenny@universal-fasteners.com jpenny@universal-fasteners.com
Tue, 27 Jun 2000 10:53:00 -0400


On Tue, Jun 27, 2000 at 12:05:56PM +1000, Andrew Kenneth Milton wrote:
> +----[ Dieter Maurer ]---------------------------------------------
> | Andrew Kenneth Milton writes:
> |  > 
> |  > So...
> |  > <dtml-in "bcd_statement(a=a, b=b, c=c)">
> | Alternatively, you could place the values from "abc_sql_statement"
> | into the "REQUEST" object:
> | 
> | 	<dtml-call "REQUEST.set(a=a)">
> | 	....
> 
> Except you get one line per variable you want to set... It's ok if you've
> only got one variable and you want to use it outside the loop, setting
> four or five would get messy I think.

Actually this is not so bad.

Set up a DTML-method that has all of these calls in it.  I like to call 
mine currySomethingArgs

For example, if you have a SQL method Foo requiring args a,b,c,d,e,f,g
then curryFooArgs would have body
<dtml-call "REQUEST.set(a=a)">
     .
     .
     .
<dtml-call "REQUEST.set(f=f)">

and your calling sequence to Foo looks like

<dtml-call curryFooArgs>
<dtml-call Foo>

This also makes the nested SQL call problem easier to read.