[ZPT] zpt + zsql

Nicola Larosa nico@tekNico.net
Fri, 07 Dec 2001 11:30:28 +0100


 > The difficult part is iteration over the result set, when it becomes
 > large. There is not "dtml-in" with all of its features.

Do you mean this stuff?

http://dev.zope.org/Wikis/DevSite/Projects/ZPT/RepeatVariable


 > More fancy stuff, like e.g. statistics, are probably done in

One thing that could be useful: only recently I discovered that a Python 
Script can refer to SQL columns *by name*, since I had seen no doc about it, 
only in mailing lists archives.

You can build a dictionary of data from a SQL query, like this:


# this returns one row only
rows = query.sql()

if not rows:
     return {}

fRow = {}
for field in rows[0].names():
     fRow[field] = rows[0][field]

return fRow


-- 
"Mozilla will be around long after nobody can remember
just quite what Internet Explorer actually used to be."
   AirLace on Slashdot

Nicola Larosa - nico@tekNico.net