summaryrefslogtreecommitdiff
path: root/heatclient/common/utils.py
diff options
context:
space:
mode:
authorSteven Hardy <shardy@redhat.com>2014-06-11 11:35:10 +0100
committerSteven Hardy <shardy@redhat.com>2014-07-24 15:48:52 +0100
commit755f609c31e735fa6abd030a6bdabb2fb36c6875 (patch)
treefafe848293eb9c70c903ef39808b65b0cc6984cc /heatclient/common/utils.py
parent6eb45625e584f410fdb33d82c63916750650505d (diff)
downloadpython-heatclient-755f609c31e735fa6abd030a6bdabb2fb36c6875.tar.gz
Add rel field to links display
Currently the "rel" keys from the links list are not displayed, so it's not that clear which link refers to what unless you're familiar with heat. So add a suffix which mentions the rel so e.g users can see "nested" there and tell the link refers to a nested stack. Change-Id: I5abe7f7b51c290bd9d8daaccb7f9a842af898f58
Diffstat (limited to 'heatclient/common/utils.py')
-rw-r--r--heatclient/common/utils.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/heatclient/common/utils.py b/heatclient/common/utils.py
index 901b526..89e4b4a 100644
--- a/heatclient/common/utils.py
+++ b/heatclient/common/utils.py
@@ -37,7 +37,12 @@ print_list = cliutils.print_list
def link_formatter(links):
- return '\n'.join([l.get('href', '') for l in links or []])
+ def format_link(l):
+ if 'rel' in l:
+ return "%s (%s)" % (l.get('href', ''), l.get('rel', ''))
+ else:
+ return "%s" % (l.get('href', ''))
+ return '\n'.join(format_link(l) for l in links or [])
def json_formatter(js):