Skip to content

Commit

Permalink
pretty_print: use - instead of _
Browse files Browse the repository at this point in the history
  • Loading branch information
Gauvain Pocentek committed Jun 22, 2013
1 parent 7175772 commit 41b6dba
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions gitlab.py
Expand Up @@ -488,21 +488,22 @@ def __str__(self):

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)
Expand Down

0 comments on commit 41b6dba

Please sign in to comment.