File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 3434class jsonEncoder (json .JSONEncoder ):
3535 def default (self , obj ):
3636 if isinstance (obj , GitlabObject ):
37- return {k : v for k , v in six .iteritems (obj .__dict__ )
38- if (not isinstance (v , BaseManager )
39- and not k [0 ] == '_' )}
37+ return obj .as_dict ()
4038 elif isinstance (obj , gitlab .Gitlab ):
4139 return {'url' : obj ._url }
4240 return json .JSONEncoder .default (self , obj )
@@ -488,6 +486,11 @@ def json(self):
488486 """
489487 return json .dumps (self , cls = jsonEncoder )
490488
489+ def as_dict (self ):
490+ """Dump the object as a dict."""
491+ return {k : v for k , v in six .iteritems (self .__dict__ )
492+ if (not isinstance (v , BaseManager ) and not k [0 ] == '_' )}
493+
491494
492495class UserKey (GitlabObject ):
493496 _url = '/users/%(user_id)s/keys'
You can’t perform that action at this time.
0 commit comments