From 3f86d36218d80b293b346b37f8be5efa6455d10c Mon Sep 17 00:00:00 2001 From: Wu Yang Date: Mon, 19 Dec 2022 12:01:58 +0800 Subject: fix: change return value to "None" in case getattr returns None to prevent error --- gitlab/v4/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gitlab/v4/cli.py') 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 -- cgit v1.2.1