Merge lp:~lifeless/storm/bug-759384 into lp:storm

Proposed by Robert Collins
Status: Merged
Merged at revision: 389
Proposed branch: lp:~lifeless/storm/bug-759384
Merge into: lp:storm
Diff against target: 43 lines (+12/-4)
2 files modified
storm/sqlobject.py (+1/-1)
storm/zope/interfaces.py (+11/-3)
To merge this branch: bzr merge lp:~lifeless/storm/bug-759384
Reviewer Review Type Date Requested Status
Jamu Kakar (community) Approve
Thomas Herve (community) Approve
Review via email: mp+57428@code.launchpad.net

Description of the change

Add a missing declaration to the ISQLObjectResultSet interface and fix a typo on __nonzero__.

To post a comment you must log in.
Revision history for this message
Thomas Herve (therve) wrote :

Looks good, +1!

review: Approve
Revision history for this message
Jamu Kakar (jkakar) wrote :

Nice work, +1!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'storm/sqlobject.py'
2--- storm/sqlobject.py 2010-10-12 12:02:01 +0000
3+++ storm/sqlobject.py 2011-04-13 03:21:32 +0000
4@@ -552,7 +552,7 @@
5 return item in result_set
6
7 def __nonzero__(self):
8- """Return C{True} if this result set doesn't contain any results.
9+ """Return C{True} if this result set contains any results.
10
11 @note: This method is provided for compatibility with SQL Object. For
12 new code, prefer L{is_empty}. It's compatible with L{ResultSet}
13
14=== modified file 'storm/zope/interfaces.py'
15--- storm/zope/interfaces.py 2011-03-15 07:54:00 +0000
16+++ storm/zope/interfaces.py 2011-04-13 03:21:32 +0000
17@@ -164,9 +164,14 @@
18 """Return the number of items in the result set."""
19
20 def __nonzero__():
21- """Boolean emulation."""
22-
23- def __contains__():
24+ """Return C{True} if this result set contains any results.
25+
26+ @note: This method is provided for compatibility with SQL Object. For
27+ new code, prefer L{is_empty}. It's compatible with L{ResultSet}
28+ which doesn't have a C{__nonzero__} implementation.
29+ """
30+
31+ def __contains__(item):
32 """Support C{if FooObject in Foo.select(query)}."""
33
34 def intersect(otherSelect, intersectAll=False, orderBy=None):
35@@ -177,6 +182,9 @@
36 @param orderBy: the order the result set should use.
37 """
38
39+ def is_empty():
40+ """Return C{True} if this result set doesn't contain any results."""
41+
42 def prejoin(prejoins):
43 """Return a new L{SelectResults} with the list of attributes prejoined.
44

Subscribers

People subscribed via source and target branches

to status/vote changes: