mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
ipalib.cli: Improve reporting of binary values in the CLI
Make sure the base64-encoded value is a string, so it is printed without the b'' markers. Part of the work for: https://fedorahosted.org/freeipa/ticket/4985 Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
parent
a9a1353098
commit
5dbb0f6fec
@ -164,10 +164,11 @@ class textui(backend.Backend):
|
||||
def encode_binary(self, value):
|
||||
"""
|
||||
Convert a binary value to base64. We know a value is binary
|
||||
if it is a python str type, otherwise it is a plain string.
|
||||
if it is a python bytes type, otherwise it is a plain string.
|
||||
This function also converts datetime and DNSName values to string.
|
||||
"""
|
||||
if type(value) is bytes:
|
||||
return base64.b64encode(value)
|
||||
return base64.b64encode(value).decode('ascii')
|
||||
elif type(value) is datetime.datetime:
|
||||
return value.strftime(LDAP_GENERALIZED_TIME_FORMAT)
|
||||
elif isinstance(value, DNSName):
|
||||
|
Loading…
Reference in New Issue
Block a user