Author: phd
Date: 2007-09-26 11:43:00 -0600 (Wed, 26 Sep 2007)
New Revision: 2993
Modified:
SQLObject/branches/0.9/docs/News.txt
SQLObject/branches/0.9/sqlobject/sresults.py
SQLObject/branches/0.9/sqlobject/tests/test_select.py
Log:
Removed SelectResults.__nonzero__, which was a design mistake. See the thread
http://mail.python.org/pipermail/python-dev/2007-September/074731.html
Modified: SQLObject/branches/0.9/docs/News.txt
===================================================================
--- SQLObject/branches/0.9/docs/News.txt 2007-09-26 17:41:47 UTC (rev 2992)
+++ SQLObject/branches/0.9/docs/News.txt 2007-09-26 17:43:00 UTC (rev 2993)
@@ -13,7 +13,7 @@
* Fixed a bug in Versioning - do not copy "alternateID" and "unique"
attributes from the versioned table.
-* A number of changes ported from `SQLObject 0.7.9`_.
+* A number of changes ported from `SQLObject 0.7.9`_ and `SQLObject 0.8.6`_.
SQLObject 0.9.1
===============
@@ -87,6 +87,10 @@
SQLObject 0.8.6
===============
+* Removed SelectResults.__nonzero__, which was a design mistake. Raising an
+ exception in __nonzero__() is inconsistent with other iterators
+ (bool(iter([])) => True).
+
* A number of changes ported from `SQLObject 0.7.9`_.
SQLObject 0.8.5
Modified: SQLObject/branches/0.9/sqlobject/sresults.py
===================================================================
--- SQLObject/branches/0.9/sqlobject/sresults.py 2007-09-26 17:41:47 UTC (rev 2992)
+++ SQLObject/branches/0.9/sqlobject/sresults.py 2007-09-26 17:43:00 UTC (rev 2993)
@@ -41,10 +41,6 @@
def __repr__(self):
return "<%s at %x>" % (self.__class__.__name__, id(self))
- def __nonzero__(self):
- raise NotImplementedError(
- "To test if a SelectResult will produce any items, use list(result) or result.count()")
-
def _getConnection(self):
return self.ops.get('connection') or self.sourceClass._connection
Modified: SQLObject/branches/0.9/sqlobject/tests/test_select.py
===================================================================
--- SQLObject/branches/0.9/sqlobject/tests/test_select.py 2007-09-26 17:41:47 UTC (rev 2992)
+++ SQLObject/branches/0.9/sqlobject/tests/test_select.py 2007-09-26 17:43:00 UTC (rev 2993)
@@ -184,8 +184,3 @@
assert IterTest.select(RLIKE(IterTest.q.name, "^sqlb.*$")).count() == 1
assert IterTest.select(RLIKE(IterTest.q.name, "^sqlb.*$")).count() == 1
assert IterTest.select(RLIKE(IterTest.q.name, "^sqlx.*$")).count() == 0
-
-def test_bool_SelectResults():
- setupClass(IterTest)
-
- raises(NotImplementedError, bool, IterTest.select())
|