diff options
Diffstat (limited to 'gitlab/objects.py')
-rw-r--r-- | gitlab/objects.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gitlab/objects.py b/gitlab/objects.py index c03e77e..9849179 100644 --- a/gitlab/objects.py +++ b/gitlab/objects.py @@ -491,6 +491,14 @@ class GitlabObject(object): return {k: v for k, v in six.iteritems(self.__dict__) if (not isinstance(v, BaseManager) and not k[0] == '_')} + def __eq__(self, other): + if type(other) is type(self): + return self.as_dict() == other.as_dict() + return False + + def __ne__(self, other): + return not self.__eq__(other) + class UserKey(GitlabObject): _url = '/users/%(user_id)s/keys' @@ -544,6 +552,15 @@ class User(GitlabObject): raise_error_from_response(r, GitlabUnblockError) self.state = 'active' + def __eq__(self, other): + if type(other) is type(self): + selfdict = self.as_dict() + otherdict = other.as_dict() + selfdict.pop(u'password', None) + otherdict.pop(u'password', None) + return selfdict == otherdict + return False + class UserManager(BaseManager): obj_cls = User |