Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[1.0.X] Applying a limit to a queryset that already had an upper limi…

…t of 0

wasn't working properly.

Backport of r9201 from trunk.


git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@9204 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 09d84c4d40d1d9796f1d0f52bc3ea1bb93a68435 1 parent 318c1c3
@malcolmt malcolmt authored
View
4 django/db/models/sql/query.py
@@ -1491,12 +1491,12 @@ def set_limits(self, low=None, high=None):
clamped to any existing high value.
"""
if high is not None:
- if self.high_mark:
+ if self.high_mark is not None:
self.high_mark = min(self.high_mark, self.low_mark + high)
else:
self.high_mark = self.low_mark + high
if low is not None:
- if self.high_mark:
+ if self.high_mark is not None:
self.low_mark = min(self.high_mark, self.low_mark + low)
else:
self.low_mark = self.low_mark + low
View
2  tests/regressiontests/queries/models.py
@@ -862,6 +862,8 @@ def __unicode__(self):
Bug #7698 -- People like to slice with '0' as the high-water mark.
>>> Item.objects.all()[0:0]
[]
+>>> Item.objects.all()[0:0][:10]
+[]
Bug #7411 - saving to db must work even with partially read result set in
another cursor.
Please sign in to comment.
Something went wrong with that request. Please try again.