diff options
author | zhangjunhui <zhangjunhui@yovole.com> | 2020-12-28 15:12:22 +0800 |
---|---|---|
committer | zhangjunhui <zhangjunhui@yovole.com> | 2020-12-29 16:29:51 +0800 |
commit | 182301ac681d7f8e1e00a8163f6ac301aad9522b (patch) | |
tree | 6612b7ed8d026fb1cd426bf32e695c06f6251974 | |
parent | 7c89521ae423e42d577e4d196f652d30470722fa (diff) | |
download | python-troveclient-182301ac681d7f8e1e00a8163f6ac301aad9522b.tar.gz |
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
-rw-r--r-- | troveclient/utils.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/troveclient/utils.py b/troveclient/utils.py index cd0be9a..2c6f809 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: |