-
Notifications
You must be signed in to change notification settings - Fork 669
Objects lose their custom_attributes during a save() #1395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks @deveaud-m! Note to self:
A similar example is here with save and sudo: #532 |
Not sure, if this is a "bug" that we can fix. We're just retrieving the info that GitLab sends. I don't think we should change that behavior. |
That's true, just that in a way #1213 was a breaking change in behavior from pre-2.6.0 🤔 and can be confusing for users maybe, the way it works. I'm thinking an extra arg here would help cover both @deveaud-m's use case for I've got #1443 as an initial lightweight approach without refactoring RESTObjects too much, @deveaud-m would this cover your issue or is it still too verbose? |
I'm ok with this change, at least it would be stated in the documentation that objects can loose their attributes while being refreshed or saved. Users then have the choice between using the "verbose" argument to persist attributes or get a new object using the API (in case concurrent accesses to that object would have been performed on the server side). |
Description of the problem, including code/CLI snippet
When saving an object (e.g. User) with
custom_attributes
, those attributes get lost an the object needs to be synced again to recover all needed attributes:This raises
AttributeError
: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 option
with_custom_attributes=True
to accesscustom_attributes
.Specifications
The text was updated successfully, but these errors were encountered: