[Zope] - ZPyGreSQLDA errors when returning no rows

Ross J. Reedstrom reedstrm@rice.edu
Tue, 26 Jan 1999 11:32:15 -0600


This is a multi-part message in MIME format.
--------------9B1EEC45457584C07511F713
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

In the fine tradition of solving your own problems (which I can because
I've got the source! Yea!) I've fixed the ZPyGreSQLDA product to return
empty result properly - 
well, not completely properly, but It Works For Me. (I'm a complete
Python newbie, as well as a Zope newbie, not to mention an SQL
beginner...)

I'm sending this to the mailing list as well as the author, since I've
had zero feedback from anybody, but did send the original cry for help
out to the list, so now the archives have the problem and an answer.

(BTW, my earlier authentication problem still exists - I can't get Zope
to recognize anyboy but the superuser, even though I'm using
ZopeHTTPServer ) 

Patch to ZPyGreSQLDA/db.py attached.

Ross J. Reedstrom wrote:
> 
> As the subject says, the ZPyGreSQLDA DA throws an error when the SQL
> query returns no rows. Is this to be expected? Do I need to write
> seperate DTML methods that handle that case? I was hoping to just get no
> objects returned, so my #in tags would execute their #else clauses.
> 
> Ross

-- 
Ross J. Reedstrom, Ph.D., <reedstrm@rice.edu> 
NSBRI Research Scientist/Programmer
Computer and Information Technology Institute
Rice University, 6100 S. Main St.,  Houston, TX 77005
--------------9B1EEC45457584C07511F713
Content-Type: text/plain; charset=us-ascii; name="db.py.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="db.py.diff"

--- ZPyGreSQLDA/db.py~	Wed Jan  6 20:29:37 1999
+++ ZPyGreSQLDA/db.py	Tue Jan 26 11:16:12 1999
@@ -182,6 +182,7 @@
             raise sys.exc_type, sys.exc_value, sys.exc_traceback
 
         if desc is None: return (), ()
+        if not result: return (), ()
 
         items=[]
         func=items.append

--------------9B1EEC45457584C07511F713--