X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fupstream%2Fdjango-ldapdb.git;a=blobdiff_plain;f=ldapdb%2F__init__.py;h=3ca9c632a5afd5dadd8b17523db2d6f47e450f36;hp=7f11e6739637925b8b48d7dcc42c434ec1cc1abb;hb=c04580563f978929bc4f06dfa85ea7a26248d688;hpb=f522a1edca8bccd27cefc6407a150ea5b98a2f07 diff --git a/ldapdb/__init__.py b/ldapdb/__init__.py index 7f11e67..3ca9c63 100644 --- a/ldapdb/__init__.py +++ b/ldapdb/__init__.py @@ -69,26 +69,16 @@ class LdapConnection(object): return DatabaseCursor(self.connection) def add_s(self, dn, modlist): - mods = [] - for field, value in modlist: - converted = convert(field, value, lambda x: x.encode(self.charset)) - if isinstance(converted, list): - mods.append((field, converted)) - else: - mods.append((field, [converted])) cursor = self._cursor() - return cursor.connection.add_s(dn.encode(self.charset), mods) + return cursor.connection.add_s(dn.encode(self.charset), modlist) def delete_s(self, dn): cursor = self._cursor() return cursor.connection.delete_s(dn.encode(self.charset)) def modify_s(self, dn, modlist): - mods = [] - for op, field, value in modlist: - mods.append((op, field, convert(field, value, lambda x: x.encode(self.charset)))) cursor = self._cursor() - return cursor.connection.modify_s(dn.encode(self.charset), mods) + return cursor.connection.modify_s(dn.encode(self.charset), modlist) def rename_s(self, dn, newrdn): cursor = self._cursor() @@ -99,12 +89,6 @@ class LdapConnection(object): results = cursor.connection.search_s(base, scope, filterstr.encode(self.charset), attrlist) output = [] for dn, attrs in results: - for field in attrs: - # FIXME : we should not reference the attribute name! - if field == "member" or field == "memberUid": - attrs[field] = convert(field, attrs[field], lambda x: x.decode(self.charset)) - else: - attrs[field] = convert(field, attrs[field][0], lambda x: x.decode(self.charset)) output.append((dn.decode(self.charset), attrs)) return output