summaryrefslogtreecommitdiff
path: root/gitlab/mixins.py
diff options
context:
space:
mode:
Diffstat (limited to 'gitlab/mixins.py')
-rw-r--r--gitlab/mixins.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/gitlab/mixins.py b/gitlab/mixins.py
index ed3b204..670f33d 100644
--- a/gitlab/mixins.py
+++ b/gitlab/mixins.py
@@ -17,6 +17,7 @@
import gitlab
from gitlab import base
+from gitlab import exceptions
class GetMixin(object):
@@ -93,13 +94,15 @@ class GetFromListMixin(ListMixin):
object: The generated RESTObject.
Raises:
- GitlabGetError: If the server cannot perform the request.
+ AttributeError: If the object could not be found in the list
"""
gen = self.list()
for obj in gen:
if str(obj.get_id()) == str(id):
return obj
+ raise exceptions.GitlabHttpError(404, "Not found")
+
class RetrieveMixin(ListMixin, GetMixin):
pass
@@ -141,7 +144,7 @@ class CreateMixin(object):
if hasattr(self, '_sanitize_data'):
data = self._sanitize_data(data, 'create')
# Handle specific URL for creation
- path = kwargs.get('path', self.path)
+ path = kwargs.pop('path', self.path)
server_data = self.gitlab.http_post(path, post_data=data, **kwargs)
return self._obj_cls(self, server_data)