[Zope] Simple ZSQL question -- variable expansion in dtml-if?

Jim Sanford jsanford@atinucleus.com
Tue, 11 Jan 2000 18:22:38 -0600


If X is being returned from an html form it will actually be a string. (Putting "X:int" in the parameter line of the ZSQL method
will not coerce it to an integer.) In that case use "_.int(X)==1"  etc. or make the varaible name "X:int" in your form.

I have production code that uses this exact type of test.

Jim
----- Original Message -----
From: J C Lawrence <claw@kanga.nu>
To: Jim Sanford <jsanford@atinucleus.com>
Cc: <zope@zope.org>
Sent: Tuesday, January 11, 2000 12:17 PM
Subject: Re: [Zope] Simple ZSQL question -- variable expansion in dtml-if?


On Tue, 11 Jan 2000 07:51:22 -0600
Jim Sanford <jsanford@atinucleus.com> wrote:

> SELECT * FROM table
> <dtml-if "X==1">
> WHERE col=1
> <dtml-elif "X==-1">
> WHERE col=0
> </dtml-if>

> should work. It assumes that X will only be between -1 and 1.

That's pretty close to what I did at the beginning and what I just
triied just now -- X doesn't get expanded for the conditional inside
a ZSQL object AFAICT.

--
J C Lawrence                                 Home: claw@kanga.nu
----------(*)                              Other: coder@kanga.nu
--=| A man is as sane as he is dangerous to his environment |=--