[ZPT] zpt + zsql

Dieter Maurer dieter@handshake.de
Fri, 7 Dec 2001 01:17:54 +0100


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