summaryrefslogtreecommitdiff
path: root/gitlab.py
diff options
context:
space:
mode:
authorGauvain Pocentek <gauvain@pocentek.net>2013-06-22 09:16:24 +0200
committerGauvain Pocentek <gauvain@pocentek.net>2013-06-22 09:26:00 +0200
commit41b6dbadcc7725248763515f77ae0f6bd4186dad (patch)
treece7cf8faea4491b13b8620d297ae6ce02f0c1b72 /gitlab.py
parent71757723088556c3bd7c325413269df946343117 (diff)
downloadgitlab-41b6dbadcc7725248763515f77ae0f6bd4186dad.tar.gz
pretty_print: use - instead of _
Diffstat (limited to 'gitlab.py')
-rw-r--r--gitlab.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/gitlab.py b/gitlab.py
index 5f60c5f..21c3c10 100644
--- a/gitlab.py
+++ b/gitlab.py
@@ -488,21 +488,22 @@ class GitlabObject(object):
def pretty_print(self, depth=0):
id = self.__dict__[self.idAttr]
- print("%sid: %s" % (" " * depth * 2, id))
+ print("%s%s: %s" % (" " * depth * 2, self.idAttr, id))
for k in sorted(self.__dict__.keys()):
- if k == "id":
+ if k == self.idAttr:
continue
v = self.__dict__[k]
+ pretty_k = k.replace('_', '-')
if isinstance(v, GitlabObject):
if depth == 0:
- print("%s:" % k)
+ print("%s:" % pretty_k)
v.pretty_print(1)
else:
- print("%s: %s" % (k, v.id))
+ print("%s: %s" % (pretty_k, v.id))
else:
if isinstance(v, Gitlab):
continue
- print("%s%s: %s" % (" " * depth * 2, k, v))
+ print("%s%s: %s" % (" " * depth * 2, pretty_k, v))
def json(self):
return json.dumps(self.__dict__, cls=jsonEncoder)