From ccd4564cbcef786f10930f67f8f827e29725777f Mon Sep 17 00:00:00 2001 From: jlaine Date: Tue, 1 Jun 2010 16:28:48 +0000 Subject: [PATCH] don't forget to use offset/limit in get_count() git-svn-id: https://svn.bolloretelecom.eu/opensource/django-ldapdb/trunk@920 e071eeec-0327-468d-9b6a-08194a12b294 --- ldapdb/models/query.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ldapdb/models/query.py b/ldapdb/models/query.py index 07a6312..3076e3f 100644 --- a/ldapdb/models/query.py +++ b/ldapdb/models/query.py @@ -211,7 +211,15 @@ class Query(BaseQuery): ) except ldap.NO_SUCH_OBJECT: return 0 - return len(vals) + + number = len(vals) + + # apply limit and offset + number = max(0, number - self.low_mark) + if self.high_mark is not None: + number = min(number, self.high_mark - self.low_mark) + + return number def get_compiler(self, using=None, connection=None): return Compiler(self, ldapdb.connection, using) -- 2.30.2