~ubuntu-branches/ubuntu/trusty/python-keystoneclient/trusty-proposed

« back to all changes in this revision

Viewing changes to keystoneclient/utils.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2013-01-18 07:44:54 UTC
  • mfrom: (1.1.17)
  • Revision ID: package-import@ubuntu.com-20130118074454-g7w5blpynohn1s48
Tags: 1:0.2.2-0ubuntu1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
    return ', '.join("'%s'" % i for i in l)
21
21
 
22
22
 
23
 
def print_list(objs, fields, formatters={}):
 
23
def print_list(objs, fields, formatters={}, order_by=None):
24
24
    pt = prettytable.PrettyTable([f for f in fields], caching=False)
25
25
    pt.aligns = ['l' for f in fields]
26
26
 
37
37
                row.append(data)
38
38
        pt.add_row(row)
39
39
 
40
 
    print pt.get_string(sortby=fields[0])
 
40
    if order_by is None:
 
41
        order_by = fields[0]
 
42
    print pt.get_string(sortby=order_by)
41
43
 
42
44
 
43
45
def _word_wrap(string, max_length=0):