[Zope] Mystified by failed variable lookups

Thomas B. Passin tpassin@mitretek.org
Mon, 7 Jan 2002 15:00:28 -0500


[Andrew J. Templin]

> I have some DTML code that looks like this:
>
> -----
> <dtml-let version="'2.0'">
> version: <dtml-var version><br>
>         <tr>
>           <td width="100%" class="displayinfo"><dtml-in
list_Dependencies><dtml-var sso_data></dtml-in></td>
>         </tr>
> </dtml-let>
> -----
>
> "list_Dependencies" is a SQL Method that calls a MySQL database.
>
> The query for list_Dependencies is:
>
> -----
> SELECT sso_data FROM SSOData,ProjectNames WHERE proj_name='<dtml-var
description sql_quote>' AND proj_id=sso_id AND sso_field="Dependencies" AND
sso_version='<dtml-var version sql_quote>'
> -----
>
> Ugly, eh?
>

You haven't seen anything if you think that's ugly!

> You'll note that I'm using the dtml-var "description" in the query; this
is a
> defined property of the containing Folder object.  If I do a lookup only
using
> the 'description' property all is well; however, the SQL Method can NEVER
find
> the 'version' variable if it is defined by FORM data (or even using
dtml-let,
> as above).  I get a KeyError.
>
> What am I not understanding here?  Is there some difference between
explicit
> properties (like those declared in the Properties page of a folder) versus
> FORM data or a variable declared using dtml-let?  If so, why can the SQL
> Method see one but not the other?
>

Sounds like you need to define the arguments for the ZSQL method.  You
didn't say you had done that.  If you didn't, go define all the arguments
that you use (like "version") and try it again.

Cheers,

Tom P