summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRavan Scafi <rscafi@leroymerlin.com.br>2019-08-14 16:31:55 -0300
committerRavan Scafi <rscafi@leroymerlin.com.br>2019-08-14 17:12:11 -0300
commit558ace9b007ff9917734619c05a7c66008a4c3f0 (patch)
treee8a31231793f53e8e9fb6e4dd1ec31f2e7153e33
parente8a3585ed0e7dfa2f64f6c3378a598120f5f8167 (diff)
downloadgitlab-558ace9b007ff9917734619c05a7c66008a4c3f0.tar.gz
fix(projects): avatar uploading for projects
-rw-r--r--docs/gl_objects/projects.rst7
-rw-r--r--gitlab/v4/objects.py1
2 files changed, 8 insertions, 0 deletions
diff --git a/docs/gl_objects/projects.rst b/docs/gl_objects/projects.rst
index 9e90c9b..f7bb4b3 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 0f709fe..5637859 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",