Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

__len__ may not return a value less than zero.

  • Loading branch information...
commit aae473d9b782d910e2b371c6738ef6abd18bd5a4 1 parent b8a23d4
@yorkedork authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 haystack/query.py
View
4 haystack/query.py
@@ -87,7 +87,7 @@ def __len__(self):
self._result_count = 0
# This needs to return the actual number of hits, not what's in the cache.
- return self._result_count - self._ignored_result_count
+ return max(self._result_count - self._ignored_result_count, 0)
def __iter__(self):
if self._cache_is_full():
@@ -114,7 +114,7 @@ def _cache_is_full(self):
if not self.query.has_run():
return False
- if len(self) <= 0:
+ if len(self) == 0:
return True
try:
Please sign in to comment.
Something went wrong with that request. Please try again.