From 182301ac681d7f8e1e00a8163f6ac301aad9522b Mon Sep 17 00:00:00 2001 From: zhangjunhui Date: Mon, 28 Dec 2020 15:12:22 +0800 Subject: [PATCH] Fix a bug in print_list when using formatters If using formatters it will raise a error that local variable 'data' referenced before assignment story: 2008472 task: 41511 Change-Id: I6c66139b54a203bd8af01e8534e4d7ce7735e02d --- troveclient/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/troveclient/utils.py b/troveclient/utils.py index cd0be9ad..2c6f809c 100644 --- a/troveclient/utils.py +++ b/troveclient/utils.py @@ -173,7 +173,7 @@ def print_list(objs, fields, formatters={}, order_by=None, obj_is_dict=False, row = [] for field in fields: if formatters and field in formatters: - row.append(formatters[field](obj)) + data = formatters[field](obj) elif obj_is_dict: data = obj.get(field, '') else: