summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWu Yang <pinxue@gmail.com>2022-12-19 12:01:58 +0800
committerNejc Habjan <hab.nejc@gmail.com>2022-12-19 15:40:45 +0100
commit3f86d36218d80b293b346b37f8be5efa6455d10c (patch)
treed18c817e2326be10d85dbefb7e25a38ec63fcd37
parent43b369f28cb9009e02bc23e772383d9ea1ded46b (diff)
downloadgitlab-3f86d36218d80b293b346b37f8be5efa6455d10c.tar.gz
fix: change return value to "None" in case getattr returns None to prevent error
-rw-r--r--gitlab/v4/cli.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/gitlab/v4/cli.py b/gitlab/v4/cli.py
index 1a6ea39..41ffa1e 100644
--- a/gitlab/v4/cli.py
+++ b/gitlab/v4/cli.py
@@ -490,7 +490,7 @@ class LegacyPrinter:
id = getattr(obj, obj._id_attr)
print(f"{obj._id_attr.replace('_', '-')}: {id}")
if obj._repr_attr:
- value = getattr(obj, obj._repr_attr, "None")
+ value = getattr(obj, obj._repr_attr, "None") or "None"
value = value.replace("\r", "").replace("\n", " ")
# If the attribute is a note (ProjectCommitComment) then we do
# some modifications to fit everything on one line