Author: phd
Date: 2005-12-12 16:11:04 +0000 (Mon, 12 Dec 2005)
New Revision: 1418
Modified:
SQLObject/branches/0.7-bugfix/sqlobject/dbconnection.py
SQLObject/branches/0.7-bugfix/sqlobject/tests/test_select.py
Log:
Merged the patch from rev 1417 from the trunk:
a patch by "j.kartnaller" <j.k...@ro...> to allow .select() without keywords.
Modified: SQLObject/branches/0.7-bugfix/sqlobject/dbconnection.py
===================================================================
--- SQLObject/branches/0.7-bugfix/sqlobject/dbconnection.py 2005-12-12 16:10:14 UTC (rev 1417)
+++ SQLObject/branches/0.7-bugfix/sqlobject/dbconnection.py 2005-12-12 16:11:04 UTC (rev 1418)
@@ -640,6 +640,8 @@
data[col.dbName] = None
else:
data[col.dbName] = obj.id
+ if not data:
+ return None
return ' AND '.join(
['%s %s %s' %
(dbName, ops.get(value, "="), self.sqlrepr(value))
Modified: SQLObject/branches/0.7-bugfix/sqlobject/tests/test_select.py
===================================================================
--- SQLObject/branches/0.7-bugfix/sqlobject/tests/test_select.py 2005-12-12 16:10:14 UTC (rev 1417)
+++ SQLObject/branches/0.7-bugfix/sqlobject/tests/test_select.py 2005-12-12 16:11:04 UTC (rev 1418)
@@ -71,9 +71,13 @@
pass
assert count == len(names)
+def test_selectBy():
+ setupClass(IterTest)
+ a = IterTest(name='a')
+ b = IterTest(name='b')
+ assert IterTest.selectBy().count() == 2
-
class Counter2(SQLObject):
n1 = IntCol(notNull=True)
|