[ZPT] zpt + zsql

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


Thanks! I found quite a bit of stuff at the ZPT Wiki on your suggestion. 
It looks a bit complicated, so I'll stick with DTML for now. Maybe when 
I have a week to learn more about batching SQL queries with python, 
etc.

---------Included Message----------
Date: Fri, 7 Dec 2001 01:17:54 +0100
From: "Dieter Maurer" <dieter@handshake.de>
Reply-To: "Dieter Maurer" <dieter@handshake.de>
To: "Donald Braman" <donald.braman@aya.yale.edu>
Cc: <zpt@zope.org>
Subject: Re: [ZPT] zpt + zsql

Donald Braman writes:
> ... ZSQL Methods in ZPT ...
> 1. Is there already a tutorial or documentation on ZPT + ZSQL 
(+Python)?
I did not yet see such documents...

> 2. If not, where is a good place for me to turn for related 
documentation.
ZSQL Methods itself are as easy (or difficult) in ZPT as they are
in DTML. You call them either implicitly (arguments via request)
or explicitly passing arguments as keyword parameters:

tal:define="sql_result1	here/sql_method;
sql_result2	python: here.sql_method(arg1=1, arg2=2, 
..);"

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

You can look at ZPT batching examples (--> ZPT Wiki, ZPT examples)
to learn how to use "ZTUtils.Batch" for batching.

More fancy stuff, like e.g. statistics, are probably done in
a Python Script.

> Also, while I'm at it, I thought I'd try to provide documentation to 
other
> people trying to do this, along with of a simple generic ZPT, Python
Script,
> and ZSQL Method that all work together. Or has this been done 
already?
There are various places with Zope related HowTo and code snippets:
zope.org, zopelabs.org, ...

See there whether you find something. If not, they will be happy
to accept your new documentation.


Dieter

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

Donald Braman
donald.braman@aya.yale.edu