- Notifications
You must be signed in to change notification settings - Fork673
Closed
Labels
Description
Description of the problem, including code/CLI snippet
When saving an object (e.g. User) withcustom_attributes
, those attributes get lost an the object needs to be synced again to recover all needed attributes:
importgitlabgl=gitlab.Gitlab(...)bob=gl.users.get(42,with_custom_attributes=True)print(bob.custom_attributes)bob.save()print(bob.custom_attributes)
This raisesAttributeError
:
Traceback (most recent call last): File ".../lib/python3.9/site-packages/gitlab/base.py", line 59, in __getattr__ return self.__dict__["_updated_attrs"][name]KeyError: 'custom_attributes'During handling of the above exception, another exception occurred:Traceback (most recent call last): File ".../lib/python3.9/site-packages/gitlab/base.py", line 62, in __getattr__ value = self.__dict__["_attrs"][name]KeyError: 'custom_attributes'During handling of the above exception, another exception occurred:Traceback (most recent call last): File ".../lib/python3.9/site-packages/gitlab/base.py", line 82, in __getattr__ return self.__dict__["_parent_attrs"][name]KeyError: 'custom_attributes'During handling of the above exception, another exception occurred:Traceback (most recent call last): File ".../attr_test.py", line 8, in <module> print(f"Bob after {json.dumps(bob.custom_attributes, indent=4)}") File ".../lib/python3.9/site-packages/gitlab/base.py", line 84, in __getattr__ raise AttributeError(name)AttributeError: custom_attributes
Expected Behavior
Restore objects'custom_attributes
after callingsave()
.
This can be reproduced with Projects and Groups.
Actual Behavior
The objects must be synced again with the optionwith_custom_attributes=True
to accesscustom_attributes
.
Specifications
- python-gitlab version: 2.6.0
- API version you are using (v3/v4): v4
- Gitlab server version (or gitlab.com): 13.10.1