Re: [Zope] embed an SQL method inside a <dtml-in> tag
Andrew Kenneth Milton writes:
+----[ wai@mahirnet.com ]--------------------------------------------- | I tried to embed an SQL method statement inside my <dtml-in> listing, the | problem I'm facing was, will Z sql method detact the value I passed in, let | say : | | # This is my first listing | <dtml-in abc_sql_statement> | #another sql_statement | <dtml-in bcd_statement> | <dtml-var xyz> | <dtml-in> | </dtml-in> | # The bcd_statement will not be requested by a form The inside loop bcd_statement needs to have the values passed to it explicitly, because values from the outer dtml-in will not be acquired.
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)"> .... Dieter
+----[ 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. -- Totally Holistic Enterprises Internet| P:+61 7 3870 0066 | Andrew Milton The Internet (Aust) Pty Ltd | F:+61 7 3870 4477 | ACN: 082 081 472 | M:+61 416 022 411 | Carpe Daemon PO Box 837 Indooroopilly QLD 4068 |akm@theinternet.com.au|
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.
participants (3)
-
Andrew Kenneth Milton -
Dieter Maurer -
jpennyï¼ universal-fasteners.com