From aa81cd281db4666b09e5333d0a2001cbe415c4f6 Mon Sep 17 00:00:00 2001 From: zhanggang Date: Tue, 12 Dec 2017 03:27:08 -0500 Subject: [PATCH] Fix print_list label name in troveclient/utils.py The output of list make nice labels from fields. Fisrt, replace underscore with space. Then, replace "id" with "ID". Finally, capitalize each word. This works fine for "*_id"(for exmaple, "flavor_id" will be replaced to "Flavor ID"), but when a word has a "id" inside, it will be wrong. For example, "cidr" will be replaced to "CIDr", actually it should be "Cidr". This change fix the problem, only "id" after a underscore will be replaced to "ID". Change-Id: I8e357c946b21dc6f6c6c79d78a45f23b440a57da --- troveclient/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/troveclient/utils.py b/troveclient/utils.py index 3dfcad0d..f4db7420 100644 --- a/troveclient/utils.py +++ b/troveclient/utils.py @@ -157,7 +157,7 @@ def print_list(objs, fields, formatters={}, order_by=None, obj_is_dict=False, for field in fields: if field not in labels: # No underscores (use spaces instead) and uppercase any ID's - label = field.replace("_", " ").replace("id", "ID") + label = field.replace("_", " ").replace(" id", " ID") # Uppercase anything else that's less than 3 chars if len(label) < 3: label = label.upper()