X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=ldapdb%2Fmodels%2Fquery.py;h=ab5f19ec727b574cc845d44995d1b4371611ead7;hb=d148d9497b40bbfe0a1056e73e72415281f9ef9f;hp=f90c9b169d6bf276714d5da5393832074c914bbc;hpb=baba34a193fe7d304d86003b19f36ed638c7ec80;p=matthijs%2Fupstream%2Fdjango-ldapdb.git diff --git a/ldapdb/models/query.py b/ldapdb/models/query.py index f90c9b1..ab5f19e 100644 --- a/ldapdb/models/query.py +++ b/ldapdb/models/query.py @@ -94,7 +94,7 @@ class Compiler(object): try: vals = self.connection.search_s( self.query.model.base_dn, - ldap.SCOPE_SUBTREE, + self.query.model.search_scope, filterstr=self.query._ldap_filter(), attrlist=attrlist, ) @@ -219,7 +219,7 @@ class Query(BaseQuery): try: vals = ldapdb.connection.search_s( self.model.base_dn, - ldap.SCOPE_SUBTREE, + self.model.search_scope, filterstr=self._ldap_filter(), attrlist=[], ) @@ -238,6 +238,9 @@ class Query(BaseQuery): def get_compiler(self, using=None, connection=None): return Compiler(self, ldapdb.connection, using) + def has_results(self, using): + return self.get_count() != 0 + def results_iter(self): "For django 1.1 compatibility" return self.get_compiler().results_iter() @@ -260,7 +263,7 @@ class QuerySet(BaseQuerySet): try: vals = ldapdb.connection.search_s( self.model.base_dn, - ldap.SCOPE_SUBTREE, + self.model.search_scope, filterstr=self.query._ldap_filter(), attrlist=[], )