[Zope] Mystified by failed variable lookups

Dieter Maurer dieter@handshake.de
Mon, 7 Jan 2002 20:35:27 +0100


Andrew J. Templin writes:
 > I have some DTML code that looks like this:
 > 
 > -----
 > <dtml-let version="'2.0'">
 > ...
 > <dtml-in list_Dependencies>
 > ...
 > "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>'
 > ...
 > I get a KeyError.
You get a "KeyError" for "version" because the DTML namespace
is not passed into Z SQL methods. You must either pass the arguments
to the Z SQL methods through a sequence of keyword arguments
or (exclusive) through "REQUEST".

Read the Z SQL chapter in the Zope book. It will tell you the details.


Dieter