From 1fa2f4f13848de14fcf16040fe9769fddafa229b Mon Sep 17 00:00:00 2001 From: jlaine Date: Sun, 10 Oct 2010 18:39:48 +0000 Subject: [PATCH] make it possible to change the search scope git-svn-id: https://svn.bolloretelecom.eu/opensource/django-ldapdb/trunk@953 e071eeec-0327-468d-9b6a-08194a12b294 --- ldapdb/models/base.py | 1 + ldapdb/models/query.py | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ldapdb/models/base.py b/ldapdb/models/base.py index f0ed746..d09a5e0 100644 --- a/ldapdb/models/base.py +++ b/ldapdb/models/base.py @@ -68,6 +68,7 @@ class Model(django.db.models.base.Model): # meta-data base_dn = None + search_scope = ldap.SCOPE_SUBTREE object_classes = ['top'] def __init__(self, *args, **kwargs): diff --git a/ldapdb/models/query.py b/ldapdb/models/query.py index f90c9b1..0b5e8ba 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=[], ) @@ -260,7 +260,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=[], ) -- 2.30.2