Skip to content

Commit

Permalink
Raise NotImplementedError on all cases, where can*-boolean is False
Browse files Browse the repository at this point in the history
  • Loading branch information
mjmaenpaa committed Nov 1, 2014
1 parent 90ebbeb commit 555cc45
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions gitlab.py
Expand Up @@ -552,20 +552,8 @@ def list(cls, gl, **kwargs):
@classmethod
def _getListOrObject(cls, gl, id, **kwargs):
if id is None and cls.getListWhenNoId:
if not cls.canList:
raise GitlabListError
return cls.list(gl, **kwargs)
elif id is None and not cls.getListWhenNoId:
if not cls.canGet:
raise GitlabGetError
return cls(gl, id, **kwargs)
elif isinstance(id, dict):
if not cls.canCreate:
raise GitlabCreateError
return cls(gl, id, **kwargs)
else:
if not cls.canGet:
raise GitlabGetError
return cls(gl, id, **kwargs)

def _getObject(self, k, v):
Expand Down Expand Up @@ -621,6 +609,8 @@ def __init__(self, gl, data=None, **kwargs):

if data is None or isinstance(data, six.integer_types) or\
isinstance(data, six.string_types):
if not self.canGet:
raise NotImplementedError
data = self.gitlab.get(self.__class__, data, **kwargs)
# Object is created because we got it from api
self._created = True
Expand Down

0 comments on commit 555cc45

Please sign in to comment.