From 4b200bc173486645e53926eabcbf25b535184cb6 Mon Sep 17 00:00:00 2001 From: Wu Yang Date: Mon, 19 Dec 2022 12:01:58 +0800 Subject: [PATCH] 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(-) diff --git a/gitlab/v4/cli.py b/gitlab/v4/cli.py index 1a6ea39db..41ffa1e9c 100644 --- a/gitlab/v4/cli.py +++ b/gitlab/v4/cli.py @@ -490,7 +490,7 @@ def display_dict(d: Dict[str, Any], padding: int) -> None: 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