rework
authorjlaine <jlaine@e071eeec-0327-468d-9b6a-08194a12b294>
Mon, 11 Apr 2011 14:44:40 +0000 (14:44 +0000)
committerjlaine <jlaine@e071eeec-0327-468d-9b6a-08194a12b294>
Mon, 11 Apr 2011 14:44:40 +0000 (14:44 +0000)
git-svn-id: https://svn.bolloretelecom.eu/opensource/django-ldapdb/trunk@1046 e071eeec-0327-468d-9b6a-08194a12b294

ldapdb/__init__.py

index dde6304e1b5d0cf8331f60ecb7d0164c3a25ff6c..1aa900725a59d96dd9ae987f23b060aee1bab0f9 100644 (file)
 # 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())