Skip to content

Commit 18415fe

Browse files
author
Gauvain Pocentek
committed
Forbid empty id for get()
Unless the class explicitly defines it's OK (getRequiresId set to True).
1 parent 8028ec7 commit 18415fe

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

gitlab/objects.py

+2
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ def get(self, id=None, **kwargs):
9999
args = self._set_parent_args(**kwargs)
100100
if not self.obj_cls.canGet:
101101
raise NotImplementedError
102+
if id is None and self.obj_cls.getRequiresId is True:
103+
raise ValueError('The id argument must be defined.')
102104
return self.obj_cls.get(self.gitlab, id, **args)
103105

104106
def list(self, **kwargs):

0 commit comments

Comments
 (0)