diff options
author | Gauvain Pocentek <gauvain@pocentek.net> | 2013-06-22 09:14:05 +0200 |
---|---|---|
committer | Gauvain Pocentek <gauvain@pocentek.net> | 2013-06-22 09:14:05 +0200 |
commit | 71757723088556c3bd7c325413269df946343117 (patch) | |
tree | 4fea6a94fc8e1da5431431fea0360715517a70a3 /gitlab.py | |
parent | 5a20efbacbb8269b2c41ac26ba4a0bb492e42c9d (diff) | |
download | gitlab-71757723088556c3bd7c325413269df946343117.tar.gz |
id attr might not available
Diffstat (limited to 'gitlab.py')
-rw-r--r-- | gitlab.py | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -396,6 +396,7 @@ class GitlabObject(object): requiredGetAttrs = [] requiredCreateAttrs = [] optionalCreateAttrs = [] + idAttr = 'id' @classmethod def list(cls, gl, **kwargs): @@ -486,7 +487,8 @@ class GitlabObject(object): return '%s => %s' % (type(self), str(self.__dict__)) def pretty_print(self, depth=0): - print("%sid: %s" % (" " * depth * 2, self.id)) + id = self.__dict__[self.idAttr] + print("%sid: %s" % (" " * depth * 2, id)) for k in sorted(self.__dict__.keys()): if k == "id": continue @@ -562,6 +564,7 @@ class Issue(GitlabObject): class ProjectBranch(GitlabObject): _url = '/projects/%(project_id)s/repository/branches' + idAttr = 'name' canDelete = False canUpdate = False canCreate = False |