[Zope-DB] ZPT and ZSQL Method calling

Dieter Maurer dieter at handshake.de
Thu Jun 24 13:55:58 EDT 2004


Ian Steel wrote at 2004-6-21 11:53 +0100:
> ... calling a ZSQL method with parameters ...

Do something like this:

  ... tal:define="
        result python:here.your_method(param1=value1, param2=value2, ...);
	row0 python:result[0];
	field row0/your_field_name;
	"

In words:

  * ZSQL Methods take their arguments either from the request object
    or (exclusively) from explicitly passed in keyword (!) arguments.

  * The result of a ZSQL Method behaves like a sequence.

    "len" (applied to "result") returns the number of rows returned.
    "result[i]" returns the "i"th row (counting from 0)

  * A row in the result behaves like an object with the field
    names as attributes and like a sequence of field values.
    "row[i]" returns the value of the "i"th field (counting from 0).

-- 
Dieter


More information about the Zope-DB mailing list