From 99d53ebccf24b5431a6c55c4d139771e9150dc43 Mon Sep 17 00:00:00 2001 From: jlaine Date: Mon, 11 Apr 2011 12:30:42 +0000 Subject: [PATCH] stop using custom "Query" object git-svn-id: https://svn.bolloretelecom.eu/opensource/django-ldapdb/trunk@1035 e071eeec-0327-468d-9b6a-08194a12b294 --- ldapdb/models/query.py | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/ldapdb/models/query.py b/ldapdb/models/query.py index 8fe595f..6b1c223 100644 --- a/ldapdb/models/query.py +++ b/ldapdb/models/query.py @@ -38,7 +38,7 @@ import ldap from django.db import connections from django.db.models.query import QuerySet as BaseQuerySet from django.db.models.query_utils import Q -from django.db.models.sql import Query as BaseQuery +from django.db.models.sql import Query from django.db.models.sql.where import WhereNode as BaseWhereNode, Constraint as BaseConstraint, AND, OR from ldapdb.backends.ldap import compiler @@ -87,31 +87,6 @@ class WhereNode(BaseWhereNode): obj = Constraint(obj.alias, obj.col, obj.field) super(WhereNode, self).add((obj, lookup_type, value), connector) -class Query(BaseQuery): - def get_count(self, using): - connection = connections[using] - try: - vals = connection.search_s( - self.model.base_dn, - self.model.search_scope, - filterstr=compiler.query_as_ldap(self), - attrlist=[], - ) - except ldap.NO_SUCH_OBJECT: - return 0 - - 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 has_results(self, using): - return self.get_count(using) != 0 - class QuerySet(BaseQuerySet): def __init__(self, model=None, query=None, using=None): if not query: -- 2.30.2