From 2c7a999f23b168f85c2b1c06296f617c626fde9d Mon Sep 17 00:00:00 2001 From: Gauvain Pocentek Date: Mon, 24 Oct 2016 21:45:20 +0200 Subject: Don't overwrite attributes returned by the server Fixes #171 --- gitlab/objects.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'gitlab') diff --git a/gitlab/objects.py b/gitlab/objects.py index e95a894..e00a4ed 100644 --- a/gitlab/objects.py +++ b/gitlab/objects.py @@ -398,7 +398,9 @@ class GitlabObject(object): if kwargs: for k, v in kwargs.items(): - self.__dict__[k] = v + # Don't overwrite attributes returned by the server (#171) + if k not in self.__dict__ or not self.__dict__[k]: + self.__dict__[k] = v # Special handling for api-objects that don't have id-number in api # responses. Currently only Labels and Files -- cgit v1.2.1