summaryrefslogtreecommitdiff
path: root/gitlab/objects.py
diff options
context:
space:
mode:
authorGauvain Pocentek <gauvain.pocentek@objectif-libre.com>2016-01-23 16:24:38 +0100
committerGauvain Pocentek <gauvain.pocentek@objectif-libre.com>2016-01-23 16:24:38 +0100
commit26d73e2828db89f9464c291de7607b7e78c58ca4 (patch)
tree8c980b3e827c9e340c3459e39b0bdc64adf6309d /gitlab/objects.py
parent3f386891ecf15ac4f0da34bdda59cf8e8d2f6ff0 (diff)
parentca6da62010ee88e1b03f7a5abbf69479103aa1e1 (diff)
downloadgitlab-26d73e2828db89f9464c291de7607b7e78c58ca4.tar.gz
Merge branch 'fix-json' of https://github.com/rhansen/python-gitlab into rhansen-fix-json
Diffstat (limited to 'gitlab/objects.py')
-rw-r--r--gitlab/objects.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/gitlab/objects.py b/gitlab/objects.py
index d0e05ea..9f3a655 100644
--- a/gitlab/objects.py
+++ b/gitlab/objects.py
@@ -31,8 +31,10 @@ from gitlab.exceptions import * # noqa
class jsonEncoder(json.JSONEncoder):
def default(self, obj):
+ from gitlab import Gitlab
if isinstance(obj, GitlabObject):
- return obj.__dict__
+ return {k: v for k, v in obj.__dict__.iteritems()
+ if not isinstance(v, BaseManager)}
elif isinstance(obj, Gitlab):
return {'url': obj._url}
return json.JSONEncoder.default(self, obj)
@@ -474,7 +476,7 @@ class GitlabObject(object):
Returns:
str: The json string.
"""
- return json.dumps(self.__dict__, cls=jsonEncoder)
+ return json.dumps(self, cls=jsonEncoder)
class UserKey(GitlabObject):