@@ -552,20 +552,8 @@ def list(cls, gl, **kwargs):
552
552
@classmethod
553
553
def _getListOrObject (cls , gl , id , ** kwargs ):
554
554
if id is None and cls .getListWhenNoId :
555
- if not cls .canList :
556
- raise GitlabListError
557
555
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 )
566
556
else :
567
- if not cls .canGet :
568
- raise GitlabGetError
569
557
return cls (gl , id , ** kwargs )
570
558
571
559
def _getObject (self , k , v ):
@@ -621,6 +609,8 @@ def __init__(self, gl, data=None, **kwargs):
621
609
622
610
if data is None or isinstance (data , six .integer_types ) or \
623
611
isinstance (data , six .string_types ):
612
+ if not self .canGet :
613
+ raise NotImplementedError
624
614
data = self .gitlab .get (self .__class__ , data , ** kwargs )
625
615
# Object is created because we got it from api
626
616
self ._created = True
0 commit comments