Applying a limit to a queryset that already had an upper limit of 0 wasn't

working properly.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@9201 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2008-10-08 08:37:35 +00:00
parent ce770aaecd
commit 268ef594ac
2 changed files with 4 additions and 2 deletions

View File

@ -1491,12 +1491,12 @@ class Query(object):
clamped to any existing high value. clamped to any existing high value.
""" """
if high is not None: 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) self.high_mark = min(self.high_mark, self.low_mark + high)
else: else:
self.high_mark = self.low_mark + high self.high_mark = self.low_mark + high
if low is not None: 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) self.low_mark = min(self.high_mark, self.low_mark + low)
else: else:
self.low_mark = self.low_mark + low self.low_mark = self.low_mark + low

View File

@ -862,6 +862,8 @@ used in lookups.
Bug #7698 -- People like to slice with '0' as the high-water mark. Bug #7698 -- People like to slice with '0' as the high-water mark.
>>> Item.objects.all()[0:0] >>> 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 Bug #7411 - saving to db must work even with partially read result set in
another cursor. another cursor.