diff options
author | Gauvain Pocentek <gauvain@pocentek.net> | 2018-05-19 08:01:33 +0200 |
---|---|---|
committer | Gauvain Pocentek <gauvain@pocentek.net> | 2018-05-19 08:03:28 +0200 |
commit | a877514d565a1273fe21e81d1d00e1ed372ece4c (patch) | |
tree | b573fca9d8ea84abc81dd46a4d3286f96366d5a3 /gitlab/mixins.py | |
parent | 5335788480d840566d745d39deb85895a5fc93af (diff) | |
download | gitlab-a877514d565a1273fe21e81d1d00e1ed372ece4c.tar.gz |
Deprecate GetFromListMixin
This mixin provides a workaround for get() for GitLab objects that don't
implement a 'get a single object' API. We are now getting conflicts
because GitLab adds GET methods, and this is against the "Implement only
what exists in the API" strategy.
Also use the proper GET API call for objects that support it.
Diffstat (limited to 'gitlab/mixins.py')
-rw-r--r-- | gitlab/mixins.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gitlab/mixins.py b/gitlab/mixins.py index 88fea2d..d3e5727 100644 --- a/gitlab/mixins.py +++ b/gitlab/mixins.py @@ -15,6 +15,8 @@ # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +import warnings + import gitlab from gitlab import base from gitlab import cli @@ -130,9 +132,13 @@ class ListMixin(object): class GetFromListMixin(ListMixin): + """This mixin is deprecated.""" + def get(self, id, **kwargs): """Retrieve a single object. + This Method is deprecated. + Args: id (int or str): ID of the object to retrieve **kwargs: Extra options to send to the Gitlab server (e.g. sudo) @@ -144,6 +150,9 @@ class GetFromListMixin(ListMixin): GitlabAuthenticationError: If authentication is not correct GitlabGetError: If the server cannot perform the request """ + warnings.warn('The get() method for this object is deprecated ' + 'and will be removed in a future version.', + DeprecationWarning) try: gen = self.list() except exc.GitlabListError: |