X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fupstream%2Fdjango-ldapdb.git;a=blobdiff_plain;f=ldapdb%2F__init__.py;h=44d4974e9148d9c5ba9738be42531ef361c854ad;hp=dde6304e1b5d0cf8331f60ecb7d0164c3a25ff6c;hb=3e119b381a67261e2b70646117f29bd799c776c1;hpb=b1bbd52d06dd8c9160ae925b5c407f642f2698c1 diff --git a/ldapdb/__init__.py b/ldapdb/__init__.py index dde6304..44d4974 100644 --- a/ldapdb/__init__.py +++ b/ldapdb/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # # django-ldapdb -# Copyright (c) 2009-2010, Bolloré telecom +# Copyright (c) 2009-2011, Bolloré telecom # All rights reserved. # # See AUTHORS file for a full list of contributors. @@ -32,11 +32,8 @@ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # -from django import db from django.conf import settings -from ldapdb.router import Router - def escape_ldap_filter(value): value = unicode(value) return value.replace('\\', '\\5c') \ @@ -47,13 +44,15 @@ def escape_ldap_filter(value): # Legacy single database support if hasattr(settings, 'LDAPDB_SERVER_URI'): + from django import db + from ldapdb.router import Router + # 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 = db.connections['ldap'] # Add the LDAP router db.router.routers.append(Router())