summaryrefslogtreecommitdiff
path: root/gitlab.py
diff options
context:
space:
mode:
authorMika Mäenpää <mika.j.maenpaa@tut.fi>2014-10-09 10:17:21 +0300
committerMika Mäenpää <mika.j.maenpaa@tut.fi>2014-10-10 15:47:27 +0300
commit40ce81e9b9cea0dd75c712ccac887afd37416996 (patch)
tree4d5731d572c5e015fdd74d9de398b20e58dd3763 /gitlab.py
parentff2d84c5f4ab1f492781c2f821347f94754991be (diff)
downloadgitlab-40ce81e9b9cea0dd75c712ccac887afd37416996.tar.gz
No reason to add kwargs to object in Gitlab.list()-method because GitlabObject
constructor can handle them.
Diffstat (limited to 'gitlab.py')
-rw-r--r--gitlab.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/gitlab.py b/gitlab.py
index 50f429e..5a3b034 100644
--- a/gitlab.py
+++ b/gitlab.py
@@ -204,14 +204,14 @@ class Gitlab(object):
cls = obj_class
if obj_class._returnClass:
cls = obj_class._returnClass
- 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'):
- continue
- for obj in l:
- obj.__dict__[k] = str(v)
- return l
+
+ # Remove parameters from kwargs before passing it to constructor
+ cls_kwargs = kwargs.copy()
+ for key in ['page', 'per_page']:
+ if key in cls_kwargs:
+ del cls_kwargs[key]
+
+ return [cls(self, item, **cls_kwargs) for item in r.json() if item is not None]
elif r.status_code == 401:
raise GitlabAuthenticationError(r.json()['message'])
else: