Skip to content

Commit

Permalink
Change ProjectUser and GroupProject base class
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Gauvain Pocentek committed Oct 21, 2017
1 parent 32ea62a commit 8c9ad29
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
19 changes: 19 additions & 0 deletions RELEASE_NOTES.rst
Expand Up @@ -4,6 +4,25 @@ Release notes

This page describes important changes between python-gitlab releases.

Changes from 1.0.2 to 1.1
=========================

* The ``ProjectUser`` class doesn't inherit from ``User`` anymore, and the
``GroupProject`` class doesn't inherit from ``Project`` anymore. The Gitlab
API doesn't provide the same set of features for these objects, so
python-gitlab objects shouldn't try to workaround that.

You can create ``User`` or ``Project`` objects from ``ProjectUser`` and
``GroupProject`` objects using the ``id`` attribute:

.. code-block:: python
for gr_project in group.projects.list():
# lazy object creation doesn't need an Gitlab API request
project = gl.projects.get(gr_project.id, lazy=True)
project.default_branch = 'develop'
project.save()
Changes from 0.21 to 1.0.0
==========================

Expand Down
4 changes: 2 additions & 2 deletions gitlab/v4/objects.py
Expand Up @@ -1601,7 +1601,7 @@ class ProjectTriggerManager(CRUDMixin, RESTManager):
_update_attrs = (('description', ), tuple())


class ProjectUser(User):
class ProjectUser(RESTObject):
pass


Expand Down Expand Up @@ -2244,7 +2244,7 @@ class ProjectManager(CRUDMixin, RESTManager):
'with_issues_enabled', 'with_merge_requests_enabled')


class GroupProject(Project):
class GroupProject(RESTObject):
pass


Expand Down

0 comments on commit 8c9ad29

Please sign in to comment.