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/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 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' diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py index 9e0256080..4bd5aada0 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' @@ -1354,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): @@ -1368,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,