diff options
author | John L. Villalovos <john@sodarock.com> | 2021-04-24 12:10:59 -0700 |
---|---|---|
committer | John L. Villalovos <john@sodarock.com> | 2021-04-24 12:10:59 -0700 |
commit | 6d551208f4bc68d091a16323ae0d267fbb6003b6 (patch) | |
tree | cd9b952ee8a9197062e0d2df870ad9202e4762cc /gitlab/v4/cli.py | |
parent | cfc42d246a4fc9a9afa9a676efcac0774e909aab (diff) | |
download | gitlab-6d551208f4bc68d091a16323ae0d267fbb6003b6.tar.gz |
chore: make RESTObject._short_print_attrs always present
Always create RESTObject._short_print_attrs with a default value of
None.
This way we don't need to use hasattr() and we will know the type of
the attribute.
Diffstat (limited to 'gitlab/v4/cli.py')
-rw-r--r-- | gitlab/v4/cli.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gitlab/v4/cli.py b/gitlab/v4/cli.py index d036d12..b03883e 100644 --- a/gitlab/v4/cli.py +++ b/gitlab/v4/cli.py @@ -380,7 +380,7 @@ class LegacyPrinter(object): if obj._id_attr: id = getattr(obj, obj._id_attr) print("%s: %s" % (obj._id_attr.replace("_", "-"), id)) - if hasattr(obj, "_short_print_attr"): + if obj._short_print_attr: value = getattr(obj, obj._short_print_attr) or "None" value = value.replace("\r", "").replace("\n", " ") # If the attribute is a note (ProjectCommitComment) then we do |