projects
/
matthijs
/
upstream
/
django-ldapdb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
do not define queryset.delete(), the base implementation works
[matthijs/upstream/django-ldapdb.git]
/
ldapdb
/
__init__.py
diff --git
a/ldapdb/__init__.py
b/ldapdb/__init__.py
index 765bb5e1d773dc12c7db392a3b4771a43915d2a6..521188cea9a0abe183e1b4bb7e547985c86ea701 100644
(file)
--- a/
ldapdb/__init__.py
+++ b/
ldapdb/__init__.py
@@
-32,8
+32,10
@@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
+from django import db
from django.conf import settings
from django.conf import settings
-from ldapdb.backends.ldap.base import DatabaseWrapper
+
+from ldapdb.router import Router
def escape_ldap_filter(value):
value = unicode(value)
def escape_ldap_filter(value):
value = unicode(value)
@@
-43,9
+45,14
@@
def escape_ldap_filter(value):
.replace(')', '\\29') \
.replace('\0', '\\00')
.replace(')', '\\29') \
.replace('\0', '\\00')
-# FIXME: is this the right place to initialize the LDAP connection?
-connection = DatabaseWrapper({
+# Add the LDAP backend
+settings.DATABASES['ldap'] = {
+ 'ENGINE': 'ldapdb.backends.ldap',
'NAME': settings.LDAPDB_SERVER_URI,
'USER': settings.LDAPDB_BIND_DN,
'NAME': settings.LDAPDB_SERVER_URI,
'USER': settings.LDAPDB_BIND_DN,
- 'PASSWORD': settings.LDAPDB_BIND_PASSWORD}, 'ldap')
+ 'PASSWORD': settings.LDAPDB_BIND_PASSWORD,
+ 'SUPPORTS_TRANSACTIONS': False}
+connection = db.connections['ldap']
+# Add the LDAP router
+db.router.routers.append(Router())