X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fupstream%2Fdjango-ldapdb.git;a=blobdiff_plain;f=ldapdb%2Fbackends%2Fldap%2Fbase.py;h=a77922134eab0f81b5cf3de70fc789e7abdf56f7;hp=1edb07de59996ddf51d9eae542e37846d975a0af;hb=04959f21602feb1e53db016d26aa1a22c5a13946;hpb=6addd55ab153402a7e5f39c71e3266b8eab54de5 diff --git a/ldapdb/backends/ldap/base.py b/ldapdb/backends/ldap/base.py index 1edb07d..a779221 100644 --- a/ldapdb/backends/ldap/base.py +++ b/ldapdb/backends/ldap/base.py @@ -35,6 +35,22 @@ 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): @@ -45,6 +61,8 @@ class DatabaseFeatures(BaseDatabaseFeatures): self.connection = connection class DatabaseOperations(BaseDatabaseOperations): + compiler_module = "ldapdb.backends.ldap.compiler" + def quote_name(self, name): return name @@ -53,12 +71,16 @@ class DatabaseWrapper(BaseDatabaseWrapper): 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']) @@ -67,6 +89,9 @@ class DatabaseWrapper(BaseDatabaseWrapper): 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) @@ -83,7 +108,7 @@ class DatabaseWrapper(BaseDatabaseWrapper): cursor = self._cursor() return cursor.connection.rename_s(dn.encode(self.charset), newrdn.encode(self.charset)) - def search_s(self, base, scope, filterstr, attrlist): + def search_s(self, base, scope, filterstr='(objectClass=*)',attrlist=None): cursor = self._cursor() results = cursor.connection.search_s(base, scope, filterstr.encode(self.charset), attrlist) output = []