Skip to content

Commit

Permalink
No reason to add kwargs to object in Gitlab.list()-method because Git…
Browse files Browse the repository at this point in the history
…labObject

constructor can handle them.
  • Loading branch information
mjmaenpaa committed Oct 10, 2014
1 parent ff2d84c commit 40ce81e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions gitlab.py
Expand Up @@ -204,14 +204,14 @@ def list(self, obj_class, **kwargs):
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:
Expand Down

0 comments on commit 40ce81e

Please sign in to comment.