python3: greedy retrieval of ldap mapped-attributes' value

This commit is contained in:
Paul Marillonnet 2020-02-07 14:09:56 +01:00
parent 5cda45d69f
commit a93bcee205
1 changed files with 2 additions and 2 deletions

View File

@ -1209,10 +1209,10 @@ class LDAPBackend(object):
new_attributes = {}
for key in attributes:
try:
new_attributes[key.lower()] = map(lambda x: force_text(x, encoding), attributes[key])
new_attributes[key.lower()] = list(map(lambda x: force_text(x, encoding), attributes[key]))
except UnicodeDecodeError:
log.debug('unable to decode attribute %r as UTF-8, converting to base64', key)
new_attributes[key.lower()] = map(base64.b64encode, attributes[key])
new_attributes[key.lower()] = list(map(base64.b64encode, attributes[key]))
return new_attributes
@classmethod