diff options
author | Masayuki Igawa <igawa@mxs.nes.nec.co.jp> | 2012-12-10 19:18:02 +0900 |
---|---|---|
committer | Masayuki Igawa <igawa@mxs.nes.nec.co.jp> | 2012-12-11 08:10:11 +0900 |
commit | 45ab2e8db759e626580b8702438b5e1f304dd193 (patch) | |
tree | f00a2a2d2a9983753d6fe74b65cf98d332145466 /keystoneclient/utils.py | |
parent | 095cdd1057c3982187f5e8bfba7f42dcc15396d0 (diff) | |
download | python-keystoneclient-45ab2e8db759e626580b8702438b5e1f304dd193.tar.gz |
Fix keystoneclient user-list output order
keystone user-list output is ordered by 'id' now.
But this order(by 'id') is not human-friendly. Sorting by 'name' is easy to
identify a user.
This patch fixes this problem.
Fixes bug 1073437
Change-Id: I00b1f46c248544157e09b2efccfff63a1f0426aa
Diffstat (limited to 'keystoneclient/utils.py')
-rw-r--r-- | keystoneclient/utils.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/keystoneclient/utils.py b/keystoneclient/utils.py index 225afe7..eae149e 100644 --- a/keystoneclient/utils.py +++ b/keystoneclient/utils.py @@ -20,7 +20,7 @@ def pretty_choice_list(l): return ', '.join("'%s'" % i for i in l) -def print_list(objs, fields, formatters={}): +def print_list(objs, fields, formatters={}, order_by=None): pt = prettytable.PrettyTable([f for f in fields], caching=False) pt.aligns = ['l' for f in fields] @@ -37,7 +37,9 @@ def print_list(objs, fields, formatters={}): row.append(data) pt.add_row(row) - print pt.get_string(sortby=fields[0]) + if order_by is None: + order_by = fields[0] + print pt.get_string(sortby=order_by) def _word_wrap(string, max_length=0): |