From 558ace9b007ff9917734619c05a7c66008a4c3f0 Mon Sep 17 00:00:00 2001 From: Ravan Scafi Date: Wed, 14 Aug 2019 16:31:55 -0300 Subject: [PATCH] fix(projects): avatar uploading for projects --- docs/gl_objects/projects.rst | 7 +++++++ gitlab/v4/objects.py | 1 + 2 files changed, 8 insertions(+) diff --git a/docs/gl_objects/projects.rst b/docs/gl_objects/projects.rst index 9e90c9b20..f7bb4b3d2 100644 --- a/docs/gl_objects/projects.rst +++ b/docs/gl_objects/projects.rst @@ -84,6 +84,13 @@ Update a project:: project.snippets_enabled = 1 project.save() +Set the avatar image for a project:: + + # the avatar image can be passed as data (content of the file) or as a file + # object opened in binary mode + project.avatar = open('path/to/file.png', 'rb') + project.save() + Delete a project:: gl.projects.delete(project_id) diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py index 0f709fe54..563785954 100644 --- a/gitlab/v4/objects.py +++ b/gitlab/v4/objects.py @@ -4463,6 +4463,7 @@ class ProjectManager(CRUDMixin, RESTManager): "ci_config_path", ), ) + _types = {"avatar": types.ImageAttribute} _list_filters = ( "search", "owned",