Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Objects lose their custom_attributes during a save() #1395

Closed
Labels
@deveaud-m

Description

@deveaud-m

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp