summaryrefslogtreecommitdiff
path: root/gitlab.py
diff options
context:
space:
mode:
Diffstat (limited to 'gitlab.py')
-rw-r--r--gitlab.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/gitlab.py b/gitlab.py
index b804294..628bf18 100644
--- a/gitlab.py
+++ b/gitlab.py
@@ -187,7 +187,7 @@ class Gitlab(object):
cls = obj_class
if obj_class._returnClass:
cls = obj_class._returnClass
- l = [cls(self, item) for item in r.json()]
+ l = [cls(self, item) for item in r.json() if item is not None]
if kwargs:
for k, v in kwargs.items():
if k in ('page', 'per_page'):
@@ -571,12 +571,26 @@ class CurrentUser(GitlabObject):
return CurrentUserKey(self.gitlab, id)
+class GroupMember(GitlabObject):
+ _url = '/groups/%(group_id)s/members'
+ canGet = False
+ canUpdate = False
+ requiredCreateAttrs = ['group_id', 'user_id', 'access_level']
+ requiredDeleteAttrs = ['group_id', 'user_id']
+ shortPrintAttr = 'username'
+
+
class Group(GitlabObject):
_url = '/groups'
_constructorTypes = {'projects': 'Project'}
requiredCreateAttrs = ['name', 'path']
shortPrintAttr = 'name'
+ def Member(self, id=None, **kwargs):
+ return self._getListOrObject(GroupMember, id,
+ group_id=self.id,
+ **kwargs)
+
def transfer_project(self, id):
url = '/groups/%d/projects/%d' % (self.id, id)
r = self.gitlab.rawPost(url, None)