Skip to content

Commit

Permalink
Merge branch 'rhansen-fix-json'
Browse files Browse the repository at this point in the history
  • Loading branch information
Gauvain Pocentek committed Jan 23, 2016
2 parents 3f38689 + 26d73e2 commit 982f54f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions gitlab/objects.py
Expand Up @@ -31,8 +31,10 @@

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)
Expand Down Expand Up @@ -474,7 +476,7 @@ def json(self):
Returns:
str: The json string.
"""
return json.dumps(self.__dict__, cls=jsonEncoder)
return json.dumps(self, cls=jsonEncoder)


class UserKey(GitlabObject):
Expand Down

0 comments on commit 982f54f

Please sign in to comment.