File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -504,6 +504,17 @@ def short_print(self, depth=0):
504504 self .shortPrintAttr .replace ('_' , '-' ),
505505 self .__dict__ [self .shortPrintAttr ]))
506506
507+ @staticmethod
508+ def _obj_to_str (obj ):
509+ if isinstance (obj , dict ):
510+ s = ", " .join (["%s: %s" % (x , GitlabObject ._obj_to_str (y )) for (x , y ) in obj .items ()])
511+ return "{ %s }" % s
512+ elif isinstance (obj , list ):
513+ s = ", " .join ([GitlabObject ._obj_to_str (x ) for x in obj ])
514+ return "[ %s ]" % s
515+ else :
516+ return str (obj )
517+
507518 def pretty_print (self , depth = 0 ):
508519 id = self .__dict__ [self .idAttr ]
509520 print ("%s%s: %s" % (" " * depth * 2 , self .idAttr , id ))
@@ -521,6 +532,7 @@ def pretty_print(self, depth=0):
521532 else :
522533 if isinstance (v , Gitlab ):
523534 continue
535+ v = GitlabObject ._obj_to_str (v )
524536 print ("%s%s: %s" % (" " * depth * 2 , pretty_k , v ))
525537
526538 def json (self ):
You can’t perform that action at this time.
0 commit comments