@@ -5,14 +5,16 @@ def to_dict(obj, classkey=None):
55 if isinstance (obj , dict ):
66 data = {}
77 for (k , v ) in obj .items ():
8- data [k ] = ZenObject . _to_dict (v , classkey )
8+ data [k ] = to_dict (v , classkey )
99
1010 return data
1111 elif hasattr (obj , '__iter__' ) and not isinstance (obj , str ):
12- return [ZenObject . _to_dict (v , classkey ) for v in obj ]
12+ return [to_dict (v , classkey ) for v in obj ]
1313 elif hasattr (obj , '__dict__' ):
1414 data = dict ([
15- (key , ZenObject ._to_dict (getattr (obj , key ), classkey ))
15+ (key , to_dict (getattr (obj , key ), classkey ))
16+ # __dir__ is used here to get dynamic properties
17+ # like Diff.currentClientTimestamp as well
1618 for key in obj .__dir__ ()
1719 if not key .startswith ('_' )
1820 and not callable (getattr (obj , key ))
@@ -38,7 +40,7 @@ def __eq__(self, obj):
3840 def _type (self ):
3941 return type (self ).__name__
4042
41- def _to_dict (self , classkey = None ):
43+ def to_dict (self , classkey = None ):
4244 return to_dict (self , classkey )
4345
4446
@@ -87,5 +89,5 @@ def _by_attr(self, attr, value):
8789 if value == attr_value :
8890 yield o
8991
90- def _to_dict (self , classkey = None ):
92+ def to_dict (self , classkey = None ):
9193 return to_dict (self , classkey )
0 commit comments