Author: daverz
Date: 2005-05-07 05:54:12 +0000 (Sat, 07 May 2005)
New Revision: 778
Modified:
trunk/SQLObject/sqlobject/dbconnection.py
Log:
In Iteration.next(), handle the case where the id is None by returning None.
With outer joins this is a common case, e.g.
Contact.select(join=LEFTJOINOn(Customer, Contact,
Customer.q.id==Contact.q.customerID))
where some customers have no contacts.
Modified: trunk/SQLObject/sqlobject/dbconnection.py
===================================================================
--- trunk/SQLObject/sqlobject/dbconnection.py 2005-05-07 05:38:05 UTC (rev 777)
+++ trunk/SQLObject/sqlobject/dbconnection.py 2005-05-07 05:54:12 UTC (rev 778)
@@ -665,6 +665,8 @@
if result is None:
self._cleanup()
raise StopIteration
+ if result[0] is None:
+ return None
if self.select.ops.get('lazyColumns', 0):
obj = self.select.sourceClass.get(result[0], connection=self.dbconn)
return obj
|