import ldap
from django.db.backends import BaseDatabaseFeatures, BaseDatabaseOperations, BaseDatabaseWrapper
+from django.db.backends.creation import BaseDatabaseCreation
+
+class DatabaseCreation(BaseDatabaseCreation):
+ def create_test_db(self, verbosity=1, autoclobber=False):
+ """
+ Creates a test database, prompting the user for confirmation if the
+ database already exists. Returns the name of the test database created.
+ """
+ pass
+
+ def destroy_test_db(self, old_database_name, verbosity=1):
+ """
+ Destroy a test database, prompting the user for confirmation if the
+ database already exists. Returns the name of the test database created.
+ """
+ pass
class DatabaseCursor(object):
def __init__(self, ldap_connection):
self.connection = connection
class DatabaseOperations(BaseDatabaseOperations):
+ compiler_module = "ldapdb.backends.ldap.compiler"
+
def quote_name(self, name):
return name
class DatabaseWrapper(BaseDatabaseWrapper):
- def __init__(self, settings_dict, alias='ldap'):
- super(DatabaseWrapper, self).__init__(settings_dict, alias=alias)
+ def __init__(self, *args, **kwargs):
+ super(DatabaseWrapper, self).__init__(*args, **kwargs)
self.charset = "utf-8"
+ self.creation = DatabaseCreation(self)
self.features = DatabaseFeatures(self)
self.ops = DatabaseOperations()
def close(self):
pass
+ def _commit(self):
+ pass
+
def _cursor(self):
if self.connection is None:
self.connection = ldap.initialize(self.settings_dict['NAME'])
self.settings_dict['PASSWORD'])
return DatabaseCursor(self.connection)
+ def _rollback(self):
+ pass
+
def add_s(self, dn, modlist):
cursor = self._cursor()
return cursor.connection.add_s(dn.encode(self.charset), modlist)