X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fupstream%2Fdjango-ldapdb.git;a=blobdiff_plain;f=ldapdb%2F__init__.py;h=767e6a9fc3030a7dfe6363e7f337e39f2054a8f5;hp=7f11e6739637925b8b48d7dcc42c434ec1cc1abb;hb=1fb23bec834636d0427e7ac6db92639c133ef1d2;hpb=f522a1edca8bccd27cefc6407a150ea5b98a2f07 diff --git a/ldapdb/__init__.py b/ldapdb/__init__.py index 7f11e67..767e6a9 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() @@ -100,11 +90,7 @@ class LdapConnection(object): 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)) + attrs[field] = convert(field, attrs[field], lambda x: x.decode(self.charset)) output.append((dn.decode(self.charset), attrs)) return output