[ZPT] zpt + zsql

Donald Braman donald.braman@aya.yale.edu
Fri, 7 Dec 2001 05:35:14 -0500


That's very cool! I think it's going to take me a little longer to 
transition to ZPT than I orignially thought, but am looking forward to 
it now. A lot more fine-grained control, which is nice. 

---------Included Message----------
Date: Fri, 07 Dec 2001 11:30:28 +0100
From: "Nicola Larosa" <nico@tekNico.net>
Reply-To: "Nicola Larosa" <nico@tekNico.net>
To: "Dieter Maurer" <dieter@handshake.de>
Cc: "Donald Braman" <donald.braman@aya.yale.edu>, <zpt@zope.org>
Subject: Re: [ZPT] zpt + zsql

> 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

---------End of Included Message----------

Donald Braman
donald.braman@aya.yale.edu