diff options
author | Gauvain Pocentek <gauvain.pocentek@objectif-libre.com> | 2016-01-23 16:48:39 +0100 |
---|---|---|
committer | Gauvain Pocentek <gauvain.pocentek@objectif-libre.com> | 2016-01-23 16:48:39 +0100 |
commit | d7271b12e91c90ad7216073354085ed2b0257f73 (patch) | |
tree | 726ea8f4ea571f7ca5e61bb651ddd9defe18f98f /gitlab/objects.py | |
parent | 982f54fb174f23e60ed40577af2d62f281d83c10 (diff) | |
download | gitlab-d7271b12e91c90ad7216073354085ed2b0257f73.tar.gz |
Fix the json() method for python 3
Also add unit tests and fix pep8 test
Diffstat (limited to 'gitlab/objects.py')
-rw-r--r-- | gitlab/objects.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/gitlab/objects.py b/gitlab/objects.py index 9f3a655..95e1e45 100644 --- a/gitlab/objects.py +++ b/gitlab/objects.py @@ -26,16 +26,17 @@ import warnings import six +import gitlab from gitlab.exceptions import * # noqa class jsonEncoder(json.JSONEncoder): def default(self, obj): - from gitlab import Gitlab if isinstance(obj, GitlabObject): - return {k: v for k, v in obj.__dict__.iteritems() - if not isinstance(v, BaseManager)} - elif isinstance(obj, Gitlab): + return {k: v for k, v in six.iteritems(obj.__dict__) + if (not isinstance(v, BaseManager) + and not k[0] == '_')} + elif isinstance(obj, gitlab.Gitlab): return {'url': obj._url} return json.JSONEncoder.default(self, obj) |