Skip to content

Commit 8c9ad29

Browse files
author
Gauvain Pocentek
committed
Change ProjectUser and GroupProject base class
python-gitlab shouldn't try to provide features that are not existing in the Gitlab API: GroupProject and ProjectUser objects should not provide unsupported API methods (no get, no create, no update). This Closes #346 by making explicit that we don't support these non-existant methods.
1 parent 32ea62a commit 8c9ad29

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

RELEASE_NOTES.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,25 @@ Release notes
44

55
This page describes important changes between python-gitlab releases.
66

7+
Changes from 1.0.2 to 1.1
8+
=========================
9+
10+
* The ``ProjectUser`` class doesn't inherit from ``User`` anymore, and the
11+
``GroupProject`` class doesn't inherit from ``Project`` anymore. The Gitlab
12+
API doesn't provide the same set of features for these objects, so
13+
python-gitlab objects shouldn't try to workaround that.
14+
15+
You can create ``User`` or ``Project`` objects from ``ProjectUser`` and
16+
``GroupProject`` objects using the ``id`` attribute:
17+
18+
.. code-block:: python
19+
20+
for gr_project in group.projects.list():
21+
# lazy object creation doesn't need an Gitlab API request
22+
project = gl.projects.get(gr_project.id, lazy=True)
23+
project.default_branch = 'develop'
24+
project.save()
25+
726
Changes from 0.21 to 1.0.0
827
==========================
928

gitlab/v4/objects.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1601,7 +1601,7 @@ class ProjectTriggerManager(CRUDMixin, RESTManager):
16011601
_update_attrs = (('description', ), tuple())
16021602

16031603

1604-
class ProjectUser(User):
1604+
class ProjectUser(RESTObject):
16051605
pass
16061606

16071607

@@ -2244,7 +2244,7 @@ class ProjectManager(CRUDMixin, RESTManager):
22442244
'with_issues_enabled', 'with_merge_requests_enabled')
22452245

22462246

2247-
class GroupProject(Project):
2247+
class GroupProject(RESTObject):
22482248
pass
22492249

22502250

0 commit comments

Comments
 (0)