X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=ldapdb%2F__init__.py;h=60b6c865710b64130469fe4f51f4a8194b1ade6f;hb=6114ec0f3314013175cc55886f2cd6085d8ae1d0;hp=c8c56eda8704e34532b4db35b0433849b8ee5922;hpb=90eac76434e76b9ec52afabd695b2c06987668d6;p=matthijs%2Fupstream%2Fdjango-ldapdb.git diff --git a/ldapdb/__init__.py b/ldapdb/__init__.py index c8c56ed..60b6c86 100644 --- a/ldapdb/__init__.py +++ b/ldapdb/__init__.py @@ -49,7 +49,7 @@ class LdapConnection(object): return self.connection.add_s(dn.encode(self.charset), mods) def delete_s(self, dn): - return self.connection.delete_s(dn) + return self.connection.delete_s(dn.encode(self.charset)) def modify_s(self, dn, modlist): mods = [] @@ -62,13 +62,15 @@ class LdapConnection(object): def search_s(self, base, scope, filterstr, attrlist): results = self.connection.search_s(base, scope, filterstr.encode(self.charset), attrlist) + output = [] for dn, attrs in results: for field in attrs: 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)) - return results + output.append((dn.decode(self.charset), attrs)) + return output # FIXME: is this the right place to initialize the LDAP connection? connection = LdapConnection(settings.LDAPDB_SERVER_URI,