[Zope-DB] Testing for empty result set

Charlie Clark charlie at egenix.com
Thu Mar 24 07:44:30 EST 2005


On 2005-03-24 at 10:45:07 [+0100], Martin Jennings <jennings at kpnqwest.ch> 
wrote:
> Hello,
> 
> thanks to the advice offered on this list some time ago, I have managed to
> get my zope/plone set-up to connect to an Oracle DB and extract data.
> 
> Now all I have to do is test for an empty result set.
> 
> I suppose that I do this using the tal:condition attribute, but am not
> sure what I am suppose to be testing.
> 
> Any help would be more than welcome.
> 
> Tank you in advance.

Martin,

your right tal:condition is what you should be using. However, as 
Results-Objects with empty records are not None you still need a little 
Python test to get things to work correctly.

<div tal:condition="python: len(context.myZSQL())">

Should work

Charlie


More information about the Zope-DB mailing list