summaryrefslogtreecommitdiff
path: root/cinderclient/utils.py
diff options
context:
space:
mode:
authorYuriy Nesenenko <ynesenenko@mirantis.com>2016-07-15 13:46:53 +0300
committerYuriy Nesenenko <ynesenenko@mirantis.com>2016-07-15 13:46:53 +0300
commit01c139181c862a47ea5b2f04b392480cb7a7a7d7 (patch)
treefae2e1c82ca91796c2feffe83371c361452e2a39 /cinderclient/utils.py
parent09b51a294ecbe8898580fa75c124a569a386d29f (diff)
downloadpython-cinderclient-01c139181c862a47ea5b2f04b392480cb7a7a7d7.tar.gz
Fix Unicode error printing extra-specs
If type-key is set to unicode the command cinder extra-specs-list fails with the ERROR: 'ascii' codec can't encode characters in position. This patch fixes it. Change-Id: Id82bfbe8870351605f53c7ca029b9aa7e6089f6a Closes-Bug: #1568937
Diffstat (limited to 'cinderclient/utils.py')
-rw-r--r--cinderclient/utils.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/cinderclient/utils.py b/cinderclient/utils.py
index 950b4bc..86c276e 100644
--- a/cinderclient/utils.py
+++ b/cinderclient/utils.py
@@ -182,8 +182,9 @@ def unicode_key_value_to_string(dictionary):
"""Recursively converts dictionary keys to strings."""
if not isinstance(dictionary, dict):
return dictionary
- return dict((str(k), str(unicode_key_value_to_string(v)))
- for k, v in dictionary.items())
+ return dict((six.text_type(k),
+ six.text_type(unicode_key_value_to_string(v)))
+ for k, v in dictionary.items())
def print_dict(d, property="Property", formatters=None):