@@ -552,20 +552,8 @@ def list(cls, gl, **kwargs):
552552 @classmethod
553553 def _getListOrObject (cls , gl , id , ** kwargs ):
554554 if id is None and cls .getListWhenNoId :
555- if not cls .canList :
556- raise GitlabListError
557555 return cls .list (gl , ** kwargs )
558- elif id is None and not cls .getListWhenNoId :
559- if not cls .canGet :
560- raise GitlabGetError
561- return cls (gl , id , ** kwargs )
562- elif isinstance (id , dict ):
563- if not cls .canCreate :
564- raise GitlabCreateError
565- return cls (gl , id , ** kwargs )
566556 else :
567- if not cls .canGet :
568- raise GitlabGetError
569557 return cls (gl , id , ** kwargs )
570558
571559 def _getObject (self , k , v ):
@@ -621,6 +609,8 @@ def __init__(self, gl, data=None, **kwargs):
621609
622610 if data is None or isinstance (data , six .integer_types ) or \
623611 isinstance (data , six .string_types ):
612+ if not self .canGet :
613+ raise NotImplementedError
624614 data = self .gitlab .get (self .__class__ , data , ** kwargs )
625615 # Object is created because we got it from api
626616 self ._created = True
0 commit comments