diff options
Diffstat (limited to 'gitlab.py')
-rw-r--r-- | gitlab.py | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -448,6 +448,23 @@ class GitlabObject(object): def __str__(self): return '%s => %s' % (type(self), str(self.__dict__)) + def pretty_print(self, depth=0): + print "%sid: %s" % (" " * depth * 2, self.id) + for k in sorted(self.__dict__.keys()): + if k == "id": + continue + v = self.__dict__[k] + if isinstance(v, GitlabObject): + if depth == 0: + print "%s:" % k + v.pretty_print(1) + else: + print "%s: %s" % (k, v.id) + else: + if isinstance(v, Gitlab): + continue + print "%s%s: %s" % (" " * depth * 2, k, v) + def json(self): return json.dumps(self.__dict__, cls=jsonEncoder) |