[Zope] Python Script control flow question

H.de.Wit@SFK.NL H.de.Wit@SFK.NL
Tue, 11 Sep 2001 16:28:01 +0200


Hello,

This should be terribly simple, but i just don't see how it should be.
I have a python script, it handels the output of a SQL statement with a
SELECT COUNT in it.
It tests the case that the count is zero (and that there is no record in
the SQLresult).

This is my idea how it should be:
SQLresult=container.SQL_statement()
if (not SQLresult):
   resultcount=0
else:
   resultcount=SQLres[0][0]
return resultcount

This doesn't return a value if the resultcount is 0, nothing seem to happen
during testing the python script.
It works fine if the resultcount>0

This however is a working script
SQLresult=container.SQL_statement()
if (not SQLresult):
   resultcount=0
   print resultcount
   return printed
else:
   resultcount=SQLres[0][0]
   return resultcount

It is ugly, but it works. Is it possible to remove the print resultatcount
and the return printed somehow?

Met vriendelijke groeten,

Hans de Wit
Stichting Farmaceutische Kengetallen
Postbus 30460
2500 GL  DEN HAAG
Tel. 070-3737448
Fax 070-3737445