From f01b5e506c720181f56e54aa89925a4720642d83 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: May 30 2016 14:44:08 +0000 Subject: ipaldap: Keep attribute names as text, not bytes Part of the work for: https://fedorahosted.org/freeipa/ticket/4985 Reviewed-By: Martin Basti --- diff --git a/ipapython/ipaldap.py b/ipapython/ipaldap.py index b69788d..e16cc46 100644 --- a/ipapython/ipaldap.py +++ b/ipapython/ipaldap.py @@ -816,7 +816,7 @@ class LDAPClient(object): If there is a problem loading the schema or the attribute is not in the schema return None """ - if isinstance(name_or_oid, unicode): + if six.PY2 and isinstance(name_or_oid, unicode): name_or_oid = name_or_oid.encode('utf-8') if name_or_oid in self._SINGLE_VALUE_OVERRIDE: @@ -1492,7 +1492,7 @@ class LDAPClient(object): # pass arguments to python-ldap with self.error_handler(): - modlist = [(a, self.encode(b), self.encode(c)) + modlist = [(a, str(b), self.encode(c)) for a, b, c in modlist] self.conn.modify_s(str(entry.dn), modlist)