summaryrefslogtreecommitdiff
path: root/gitlab.py
diff options
context:
space:
mode:
authorGauvain Pocentek <gauvain@pocentek.net>2013-06-22 09:14:05 +0200
committerGauvain Pocentek <gauvain@pocentek.net>2013-06-22 09:14:05 +0200
commit71757723088556c3bd7c325413269df946343117 (patch)
tree4fea6a94fc8e1da5431431fea0360715517a70a3 /gitlab.py
parent5a20efbacbb8269b2c41ac26ba4a0bb492e42c9d (diff)
downloadgitlab-71757723088556c3bd7c325413269df946343117.tar.gz
id attr might not available
Diffstat (limited to 'gitlab.py')
-rw-r--r--gitlab.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/gitlab.py b/gitlab.py
index 9ee2e4c..5f60c5f 100644
--- a/gitlab.py
+++ b/gitlab.py
@@ -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