summaryrefslogtreecommitdiffstats
path: root/ipapython
diff options
context:
space:
mode:
Diffstat (limited to 'ipapython')
-rw-r--r--ipapython/ipaldap.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/ipapython/ipaldap.py b/ipapython/ipaldap.py
index 28bfcb5c2..7522c504b 100644
--- a/ipapython/ipaldap.py
+++ b/ipapython/ipaldap.py
@@ -346,11 +346,16 @@ class LDAPEntry(collections.MutableMapping):
return self._names[name]
if self._conn.schema is not None:
+ if six.PY2:
+ encoded_name = name.encode('utf-8')
+ else:
+ encoded_name = name
attrtype = self._conn.schema.get_obj(
- ldap.schema.AttributeType, name.encode('utf-8'))
+ ldap.schema.AttributeType, encoded_name)
if attrtype is not None:
for altname in attrtype.names:
- altname = altname.decode('utf-8')
+ if six.PY2:
+ altname = altname.decode('utf-8')
self._names[altname] = name
self._names[name] = name
@@ -774,8 +779,9 @@ class LDAPClient(object):
if not self._decode_attrs:
return bytes
- if isinstance(name_or_oid, unicode):
- name_or_oid = name_or_oid.encode('utf-8')
+ if six.PY2:
+ if isinstance(name_or_oid, unicode):
+ name_or_oid = name_or_oid.encode('utf-8')
# Is this a special case attribute?
if name_or_oid in self._SYNTAX_OVERRIDE: