[Zope] Mystified by failed variable lookups

Andrew J. Templin bobcat@templin.net
Sun, 6 Jan 2002 21:03:47 -0800


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'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?

Awaiting enlightenment and many thanks,

Andrew

-- 
Andrew J. Templin -  zope@alienminds.org
Recovering Sysadmin/Confused Programmer/Cosmic Stir Stick/Meta-Paranoid
PGP & GPG keys available at http://www.alienminds.org/~nosilla/
"After the data was wiped, the claymores would detonate" - Andrew Downie