mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2026-08-13 06:25:00 -05:00
ipaldap, ldapupdate: Encoding fixes for Python 3
https://fedorahosted.org/freeipa/ticket/5638 Reviewed-By: Jan Cholasta <jcholast@redhat.com>
This commit is contained in:
committed by
Jan Cholasta
parent
831856ea55
commit
fe7bd36728
+10
-4
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user