From 9a3c42aac1ccc9b34c4ec4b300d07b003c439248 Mon Sep 17 00:00:00 2001 From: jlaine Date: Mon, 11 Apr 2011 10:45:25 +0000 Subject: [PATCH] register LDAP router git-svn-id: https://svn.bolloretelecom.eu/opensource/django-ldapdb/trunk@1025 e071eeec-0327-468d-9b6a-08194a12b294 --- ldapdb/__init__.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ldapdb/__init__.py b/ldapdb/__init__.py index 7dde301..cfa1dd3 100644 --- a/ldapdb/__init__.py +++ b/ldapdb/__init__.py @@ -32,8 +32,10 @@ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # +from django import db from django.conf import settings -from django.db import connections + +from ldapdb.router import Router def escape_ldap_filter(value): value = unicode(value) @@ -43,11 +45,13 @@ def escape_ldap_filter(value): .replace(')', '\\29') \ .replace('\0', '\\00') -# Add the LDAP backend to the configured databases +# Add the LDAP backend settings.DATABASES['ldap'] = { 'ENGINE': 'ldapdb.backends.ldap', 'NAME': settings.LDAPDB_SERVER_URI, 'USER': settings.LDAPDB_BIND_DN, 'PASSWORD': settings.LDAPDB_BIND_PASSWORD} -connection = connections['ldap'] +connection = db.connections['ldap'] +# Add the LDAP router +db.router.routers.append(Router()) -- 2.30.2