diff options
author | Lei Zhang <zhang.lei.fly@gmail.com> | 2013-11-12 22:23:49 +0800 |
---|---|---|
committer | Lei Zhang <zhang.lei.fly@gmail.com> | 2013-11-25 12:02:40 +0800 |
commit | 98231f6ccdbbf248d479efef09b88f7abee49383 (patch) | |
tree | d71c846a8b7e847544da836ea5851d1d361a004e /keystoneclient/utils.py | |
parent | dca1d4259d44a0d282396a18c895de834580fe66 (diff) | |
download | python-keystoneclient-98231f6ccdbbf248d479efef09b88f7abee49383.tar.gz |
Encode the text before print it to console
Closes-Bug: #1250490
Change-Id: I516806a0f8a136bb66c64dcdcd07cee6d297e619
Diffstat (limited to 'keystoneclient/utils.py')
-rw-r--r-- | keystoneclient/utils.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/keystoneclient/utils.py b/keystoneclient/utils.py index 6902ed3..400c401 100644 --- a/keystoneclient/utils.py +++ b/keystoneclient/utils.py @@ -20,6 +20,7 @@ import prettytable import six from keystoneclient import exceptions +from keystoneclient.openstack.common import strutils # Decorator for cli-args @@ -56,7 +57,7 @@ def print_list(objs, fields, formatters={}, order_by=None): if order_by is None: order_by = fields[0] - print(pt.get_string(sortby=order_by)) + print(strutils.safe_encode(pt.get_string(sortby=order_by))) def _word_wrap(string, max_length=0): @@ -80,7 +81,7 @@ def print_dict(d, wrap=0): value = '' value = _word_wrap(value, max_length=wrap) pt.add_row([prop, value]) - print(pt.get_string(sortby='Property')) + print(strutils.safe_encode(pt.get_string(sortby='Property'))) def find_resource(manager, name_or_id): |