summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Wittig <max.wittig.ch@gmail.com>2021-04-25 16:34:50 +0200
committerGitHub <noreply@github.com>2021-04-25 16:34:50 +0200
commit09522b356386f4e2ceef7e8c2604269e0682ed20 (patch)
treeeadab753e5dd338c64c332a7db06d339bb0ad7ec
parent0a0fcaf27fe18867d2b4860badb52cafdac555cb (diff)
parent6d551208f4bc68d091a16323ae0d267fbb6003b6 (diff)
downloadgitlab-09522b356386f4e2ceef7e8c2604269e0682ed20.tar.gz
Merge pull request #1410 from JohnVillalovos/jlvillal/short_print_attr
chore: make RESTObject._short_print_attrs always present
-rw-r--r--gitlab/base.py1
-rw-r--r--gitlab/v4/cli.py2
2 files changed, 2 insertions, 1 deletions
diff --git a/gitlab/base.py b/gitlab/base.py
index 8f4e49b..7121cb0 100644
--- a/gitlab/base.py
+++ b/gitlab/base.py
@@ -45,6 +45,7 @@ class RESTObject(object):
_attrs: Dict[str, Any]
_module: ModuleType
_parent_attrs: Dict[str, Any]
+ _short_print_attr: Optional[str] = None
_updated_attrs: Dict[str, Any]
manager: "RESTManager"
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