summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ipalib/cli.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/ipalib/cli.py b/ipalib/cli.py
index 3592d3b61..3692e4e53 100644
--- a/ipalib/cli.py
+++ b/ipalib/cli.py
@@ -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):