diff options
| author | jiansong <jian.song@easystack.cn> | 2017-09-29 20:28:54 -0700 |
|---|---|---|
| committer | jian.song <jian.song@easystack.cn> | 2017-11-03 11:15:45 +0000 |
| commit | fd076ed1ba1ec8cc6d82b5ea103cdff39b607532 (patch) | |
| tree | 20b87964df359ecfe3c1b76cf76164caabd72165 | |
| parent | a397f72da43b8a09d5995f88df966918044583e3 (diff) | |
| download | python-troveclient-fd076ed1ba1ec8cc6d82b5ea103cdff39b607532.tar.gz | |
ESFIX:Fix troveclient error with Chinese character
Now troveclient does not support returning Chinese characters, so
to make changes.This should also avoid other unicode output
problems
Change-Id: Ie948cff4e81806f17c697f50271992cc492c48f4
Closes-Bug: #1720490
| -rw-r--r-- | troveclient/utils.py | 5 | ||||
| -rw-r--r-- | troveclient/v1/shell.py | 3 |
2 files changed, 6 insertions, 2 deletions
diff --git a/troveclient/utils.py b/troveclient/utils.py index 69e0b3d..e39ada3 100644 --- a/troveclient/utils.py +++ b/troveclient/utils.py @@ -181,7 +181,10 @@ def print_list(objs, fields, formatters={}, order_by=None, obj_is_dict=False, data = obj.get(field, '') else: data = getattr(obj, field, '') - row.append(str(data)) + if isinstance(data, six.string_types): + row.append(data.encode('utf-8')) + else: + row.append(str(data)) # set the alignment to right-aligned if it's a numeric if set_align and hasattr(data, '__int__'): align[labels[field]] = 'r' diff --git a/troveclient/v1/shell.py b/troveclient/v1/shell.py index 95fb7d9..5e3202c 100644 --- a/troveclient/v1/shell.py +++ b/troveclient/v1/shell.py @@ -231,7 +231,8 @@ def do_flavor_list(cs, args): utils.print_list(_flavors, ['id', 'name', 'ram', 'vcpus', 'disk', 'ephemeral'], - labels={'ram': 'RAM', 'vcpus': 'vCPUs', 'disk': 'Disk'}) + labels={'ram': 'RAM', 'vcpus': 'vCPUs', 'disk': 'Disk'}, + order_by='ram') @utils.arg('flavor', metavar='<flavor>', type=str, |
