[Zope] DTML and SQL question...

Dieter Maurer dieter@handshake.de
Thu, 16 Nov 2000 22:02:36 +0100 (CET)


zope writes:
 > I want to test if there is some data in a table.
In Zope, ZSQL methods return objects that behave like a
sequence (of hit rows).

In Python, an empty sequence is false while a non-empty sequence
is true.

Thus, you can use:

      <dtml-if "ZSQLmethod(....)">
      ....

to test any SQL query for a non-empty result set.

The "_.len(...)" function returns the length of a sequence,
in case you are interested in the number of hits.


Dieter