summaryrefslogtreecommitdiff
path: root/gitlab/mixins.py
diff options
context:
space:
mode:
authorJohn L. Villalovos <john@sodarock.com>2022-07-20 08:34:08 -0700
committerJohn L. Villalovos <john@sodarock.com>2022-07-20 08:34:08 -0700
commita7e8cfbae8e53d2c4b1fb75d57d42f00db8abd81 (patch)
treeb856fc6cf2dfb93148a67655acd8054ecd177600 /gitlab/mixins.py
parentf6b6e18f96f4cdf67c8c53ae79e6a8259dcce9ee (diff)
downloadgitlab-a7e8cfbae8e53d2c4b1fb75d57d42f00db8abd81.tar.gz
chore: add a `lazy` boolean attribute to `RESTObject`
This can be used to tell if a `RESTObject` was created using `lazy=True`. Add a message to the `AttributeError` if attribute access fails for an instance created with `lazy=True`.
Diffstat (limited to 'gitlab/mixins.py')
-rw-r--r--gitlab/mixins.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/gitlab/mixins.py b/gitlab/mixins.py
index 519e83f..f33a1fc 100644
--- a/gitlab/mixins.py
+++ b/gitlab/mixins.py
@@ -135,11 +135,11 @@ class GetMixin(HeadMixin, _RestManagerBase):
if lazy is True:
if TYPE_CHECKING:
assert self._obj_cls._id_attr is not None
- return self._obj_cls(self, {self._obj_cls._id_attr: id})
+ return self._obj_cls(self, {self._obj_cls._id_attr: id}, lazy=lazy)
server_data = self.gitlab.http_get(path, **kwargs)
if TYPE_CHECKING:
assert not isinstance(server_data, requests.Response)
- return self._obj_cls(self, server_data)
+ return self._obj_cls(self, server_data, lazy=lazy)
class GetWithoutIdMixin(HeadMixin, _RestManagerBase):