From f02239cee9e2e422c6c8075b5848216ec7d31f22 Mon Sep 17 00:00:00 2001 From: Cyril Roelandt Date: Wed, 11 Dec 2013 20:19:15 +0100 Subject: [PATCH] Make _get_utf8_value Python3 compliant This function now works with both Python 2 and 3. Thanks to Victor Stinner for helping with this. Change-Id: I1644db7705f7818471d06fb74a4b9a91956e6b58 --- keystoneclient/contrib/ec2/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/keystoneclient/contrib/ec2/utils.py b/keystoneclient/contrib/ec2/utils.py index 3eaa60733..17d4343ca 100644 --- a/keystoneclient/contrib/ec2/utils.py +++ b/keystoneclient/contrib/ec2/utils.py @@ -101,9 +101,9 @@ class Ec2Signer(object): @staticmethod def _get_utf8_value(value): """Get the UTF8-encoded version of a value.""" - if not isinstance(value, str) and not isinstance(value, unicode): + if not isinstance(value, (six.binary_type, six.text_type)): value = str(value) - if isinstance(value, unicode): + if isinstance(value, six.text_type): return value.encode('utf-8') else: return value