[Zope] ZPT, DTML, SQL and Forms

hans hans@beehive.de
Tue, 26 Mar 2002 12:14:08 +0000


Colin Fox wrote:

> This works if the form has itself as an action target. But what is the
> namespace for the variables returned by a ZSQL call? The column has the
> same name as the field (in this case, 'first_name'). How do I access the
> returned values from an ZSQL call?

A ZSQL Method call returns a list of dictionaries (at least to dtml),
each dictionary { 'colname':colvalue } just like a table in Python
(details: http://www.zope.org/Members/spinwing/ZSQL_Results and sourcecode).
In Python, access as myresult[nr_of_row]['name_of_col']
to get a single value.
-------------------------------------------------------------
Who's got only a hammer sees the world as a nail
hans augustin  (software developer)           hans@beehive.de
beehive elektronische medien GmbH       http://www.beehive.de
phone: +49 30 847-82 0                  fax: +49 30 847-82 299