Skip to content

UserProject missing attributes/functions compared to Project #2747

Description

@rickykwanix

Description of the problem, including code/CLI snippet

It is unintuitive for me that I am unable to access .pipelineschedules() on a project that came from myuser.projects.list(). But the object with the same project id that came from gl.projects.list(all=True) has the attribute. I think it'd be more intuitive to have the UserProject interface in the same way as Project. Having the extra API calls to gl.projects.get(<project_id>) the projects so that I can access those missing attributes is not ideal.

Maybe this is by design. If so, please help me understand why.

Expected Behavior

import gitlab
gl = gitlab.Gitlab(...)
user = gl.users.get(123)
user_project = user.projects.list()[0]
print(user_project.id)
print(user_project.pipelineschedules.list(scope="active"))

Actual Behavior

4712
Traceback (most recent call last):
  File "/path/to/test.py", line 37, in <module>
    print(user_project.pipelineschedules.list(scope="active"))
  File "/root/.pyenv/versions/3.9.15/lib/python3.9/site-packages/gitlab/base.py", line 134, in __getattr__
    raise AttributeError(message)
AttributeError: 'UserProject' object has no attribute 'pipelineschedules'

<class 'gitlab.v4.objects.users.UserProject'> was created via a list()
call and only a subset of the data may be present. To ensure all data
is present get the object using a get(object.id) call. For more
details, see:

https://python-gitlab.readthedocs.io/en/v4.2.0/faq.html#attribute-error-list

Specifications

  • python-gitlab version: 4.2.0
  • API version you are using (v3/v4): v4
  • Gitlab server version (or gitlab.com): 15.11.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions