From 94841060e3417d571226fd5e6da35d5080ac3ecb Mon Sep 17 00:00:00 2001 From: Gauvain Pocentek Date: Tue, 26 Sep 2017 07:07:35 +0200 Subject: [PATCH 1/4] [docs] remove example usage of submanagers Closes #324 --- docs/gl_objects/projects.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/gl_objects/projects.py b/docs/gl_objects/projects.py index 8fbcf2b88..f0a4d1a66 100644 --- a/docs/gl_objects/projects.py +++ b/docs/gl_objects/projects.py @@ -32,8 +32,7 @@ # user create alice = gl.users.list(username='alice')[0] -user_project = gl.user_projects.create({'name': 'project', - 'user_id': alice.id}) +user_project = alice.projects.create({'name': 'project'}) # end user create # update @@ -51,7 +50,7 @@ fork = project.forks.create({}) # fork to a specific namespace -fork = gl.project_forks.create({'namespace': 'myteam'}, project_id=1) +fork = project.forks.create({'namespace': 'myteam'}) # end fork # forkrelation From 69f1045627d8b5a9bdc51f8b74bf4394c95c8d9f Mon Sep 17 00:00:00 2001 From: Gauvain Pocentek Date: Wed, 27 Sep 2017 09:37:50 +0200 Subject: [PATCH 2/4] Properly handle the labels attribute in ProjectMergeRequest This should have made it into e09581fc but something went wrong (probably a PEBCAK). Closes #325 --- gitlab/v4/objects.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py index 9e0256080..a7bad18bc 100644 --- a/gitlab/v4/objects.py +++ b/gitlab/v4/objects.py @@ -1213,6 +1213,12 @@ class ProjectMergeRequestManager(CRUDMixin, RESTManager): 'milestone_id')) _list_filters = ('iids', 'state', 'order_by', 'sort') + def _sanitize_data(self, data, action): + new_data = data.copy() + if 'labels' in data: + new_data['labels'] = ','.join(data['labels']) + return new_data + class ProjectMilestone(SaveMixin, ObjectDeleteMixin, RESTObject): _short_print_attr = 'title' From 05656bbe237707794e9dd1e75e453413c0cf25a5 Mon Sep 17 00:00:00 2001 From: Gauvain Pocentek Date: Fri, 29 Sep 2017 07:08:47 +0200 Subject: [PATCH 3/4] ProjectFile: handle / in path for delete() and save() Fixes #326 --- gitlab/v4/objects.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py index a7bad18bc..4bd5aada0 100644 --- a/gitlab/v4/objects.py +++ b/gitlab/v4/objects.py @@ -1360,6 +1360,7 @@ def save(self, branch, commit_message, **kwargs): """ self.branch = branch self.commit_message = commit_message + self.file_path = self.file_path.replace('/', '%2F') super(ProjectFile, self).save(**kwargs) def delete(self, branch, commit_message, **kwargs): @@ -1374,7 +1375,8 @@ def delete(self, branch, commit_message, **kwargs): GitlabAuthenticationError: If authentication is not correct GitlabDeleteError: If the server cannot perform the request """ - self.manager.delete(self.get_id(), branch, commit_message, **kwargs) + file_path = self.get_id().replace('/', '%2F') + self.manager.delete(file_path, branch, commit_message, **kwargs) class ProjectFileManager(GetMixin, CreateMixin, UpdateMixin, DeleteMixin, From 9e09cf618a01e2366f2ae7d66874f4697567cfc3 Mon Sep 17 00:00:00 2001 From: Gauvain Pocentek Date: Fri, 29 Sep 2017 11:12:53 +0200 Subject: [PATCH 4/4] Prepare the 1.0.2 release --- ChangeLog.rst | 8 ++++++++ gitlab/__init__.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog.rst b/ChangeLog.rst index 2ecb7cb02..7dbdda67b 100644 --- a/ChangeLog.rst +++ b/ChangeLog.rst @@ -1,6 +1,13 @@ ChangeLog ========= +Version 1.0.2_ - 2017-09-29 +--------------------------- + +* [docs] remove example usage of submanagers +* Properly handle the labels attribute in ProjectMergeRequest +* ProjectFile: handle / in path for delete() and save() + Version 1.0.1_ - 2017-09-21 --------------------------- @@ -462,6 +469,7 @@ Version 0.1 - 2013-07-08 * Initial release +.. _1.0.2: https://github.com/python-gitlab/python-gitlab/compare/1.0.1...1.0.2 .. _1.0.1: https://github.com/python-gitlab/python-gitlab/compare/1.0.0...1.0.1 .. _1.0.0: https://github.com/python-gitlab/python-gitlab/compare/0.21.2...1.0.0 .. _0.21.2: https://github.com/python-gitlab/python-gitlab/compare/0.21.1...0.21.2 diff --git a/gitlab/__init__.py b/gitlab/__init__.py index 36a93ed9f..25b0b866c 100644 --- a/gitlab/__init__.py +++ b/gitlab/__init__.py @@ -34,7 +34,7 @@ from gitlab.v3.objects import * # noqa __title__ = 'python-gitlab' -__version__ = '1.0.1' +__version__ = '1.0.2' __author__ = 'Gauvain Pocentek' __email__ = 'gauvain@pocentek.net' __license__ = 'LGPL3'