Convert bytes to string in get_id for python3 compatibility
base64.b32encode() will return bytes in python3, let's convert it to string. Partially-Implements: blueprint magnum-python3 Change-Id: I8c9920e29e090f6b68aa95943484bea6af937eb3
This commit is contained in:
@@ -51,7 +51,10 @@ def get_id(source_uuid):
|
||||
# The first 12 bytes (= 60 bits) of base32-encoded output is our data
|
||||
encoded = base64.b32encode(six.b(random_bytes))[:12]
|
||||
|
||||
return encoded.lower()
|
||||
if six.PY3:
|
||||
return encoded.lower().decode('utf-8')
|
||||
else:
|
||||
return encoded.lower()
|
||||
|
||||
|
||||
def generate_id():
|
||||
|
||||
Reference in New Issue
Block a user