actually register database
authorjlaine <jlaine@e071eeec-0327-468d-9b6a-08194a12b294>
Mon, 11 Apr 2011 10:33:31 +0000 (10:33 +0000)
committerjlaine <jlaine@e071eeec-0327-468d-9b6a-08194a12b294>
Mon, 11 Apr 2011 10:33:31 +0000 (10:33 +0000)
git-svn-id: https://svn.bolloretelecom.eu/opensource/django-ldapdb/trunk@1024 e071eeec-0327-468d-9b6a-08194a12b294

ldapdb/__init__.py

index 765bb5e..7dde301 100644 (file)
@@ -33,7 +33,7 @@
 #
 
 from django.conf import settings
-from ldapdb.backends.ldap.base import DatabaseWrapper
+from django.db import connections
 
 def escape_ldap_filter(value):
     value = unicode(value)
@@ -43,9 +43,11 @@ def escape_ldap_filter(value):
                 .replace(')', '\\29') \
                 .replace('\0', '\\00')
 
-# FIXME: is this the right place to initialize the LDAP connection?
-connection = DatabaseWrapper({
+# Add the LDAP backend to the configured databases
+settings.DATABASES['ldap'] = {
+    'ENGINE': 'ldapdb.backends.ldap',
     'NAME': settings.LDAPDB_SERVER_URI,
     'USER': settings.LDAPDB_BIND_DN,
-    'PASSWORD': settings.LDAPDB_BIND_PASSWORD}, 'ldap')
+    'PASSWORD': settings.LDAPDB_BIND_PASSWORD}
+connection = connections['ldap']