~allenap/storm/interface-rationale-bug-659883

« back to all changes in this revision

Viewing changes to storm/sqlobject.py

  • Committer: Jamu Kakar
  • Author(s): Jeroen T. Vermeulen
  • Date: 2010-10-12 12:37:48 UTC
  • mfrom: (375.1.1 bug-659078)
  • Revision ID: jkakar@kakar.ca-20101012123748-tj1fmri7p69ukrsf
Merged bug-659078 [r=BjornT,jkakar] [f=659078]

The logic in SQLObjectResultSet.__nonzero__ and is_empty methods was
inverted and is now fixed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#
2
 
# Copyright (c) 2006, 2007 Canonical
 
2
# Copyright (c) 2006-2010 Canonical
3
3
#
4
4
# Written by Gustavo Niemeyer <gustavo@niemeyer.net>
5
5
#
558
558
            new code, prefer L{is_empty}.  It's compatible with L{ResultSet}
559
559
            which doesn't have a C{__nonzero__} implementation.
560
560
        """
561
 
        return self.is_empty()
 
561
        return not self.is_empty()
562
562
 
563
563
    def is_empty(self):
564
564
        """Return C{True} if this result set doesn't contain any results."""
565
565
        result_set = self._without_prejoins()._result_set
566
 
        return not result_set.is_empty()
 
566
        return result_set.is_empty()
567
567
 
568
568
    def count(self):
569
569
        result_set = self._without_prejoins()._result_set