~ubuntu-branches/ubuntu/trusty/python-softlayer/trusty

« back to all changes in this revision

Viewing changes to SoftLayer/CLI/formatting.py

  • Committer: Package Import Robot
  • Author(s): Alessio Treglia
  • Date: 2013-11-24 23:43:01 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20131124234301-9xqccxig339g04j5
Tags: 3.0.1-1
New upstream bugfix release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
126
126
    return SequentialOutput(separator, items)
127
127
 
128
128
 
 
129
def active_txn(item):
 
130
    """ Returns a FormattedItem describing the active transaction (if any) on
 
131
        the given object. If no active transaction is running, returns a blank
 
132
        FormattedItem.
 
133
 
 
134
        :param item: An object capable of having an active transaction
 
135
    """
 
136
    if not item['activeTransaction']['transactionStatus']:
 
137
        return blank()
 
138
 
 
139
    return FormattedItem(
 
140
        item['activeTransaction']['transactionStatus'].get('name'),
 
141
        item['activeTransaction']['transactionStatus'].get('friendlyName'))
 
142
 
 
143
 
129
144
def valid_response(prompt, *valid):
130
145
    ans = raw_input(prompt).lower()
131
146