Skip to content

Commit

Permalink
Forbid empty id for get()
Browse files Browse the repository at this point in the history
Unless the class explicitly defines it's OK (getRequiresId set to True).
  • Loading branch information
Gauvain Pocentek committed Jan 2, 2017
1 parent 8028ec7 commit 18415fe
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions gitlab/objects.py
Expand Up @@ -99,6 +99,8 @@ def get(self, id=None, **kwargs):
args = self._set_parent_args(**kwargs)
if not self.obj_cls.canGet:
raise NotImplementedError
if id is None and self.obj_cls.getRequiresId is True:
raise ValueError('The id argument must be defined.')
return self.obj_cls.get(self.gitlab, id, **args)

def list(self, **kwargs):
Expand Down

0 comments on commit 18415fe

Please sign in to comment.