##// END OF EJS Templates
schain serializer: minor changes
Miguel Valdez -
r705:2b21a763c9a1
parent child
Show More
@@ -11,9 +11,9 from schainpy.model.data.jrodata import *
11
11
12 CLASSNAME_KEY = 'classname__'
12 CLASSNAME_KEY = 'classname__'
13
13
14 def isNotClassVar(myObj):
14 def isObject(myObj):
15
15
16 return not hasattr(myObj,'__dict__')
16 return hasattr(myObj,'__dict__')
17
17
18 def isDictFormat(thisValue):
18 def isDictFormat(thisValue):
19
19
@@ -39,13 +39,12 def obj2Dict(myObj, keyList=[]):
39 if thisKey not in keyList:
39 if thisKey not in keyList:
40 continue
40 continue
41
41
42 if isNotClassVar(thisValue):
42 if not isObject(thisValue):
43 myDict[thisKey] = thisValue
43 myDict[thisKey] = thisValue
44 continue
44 continue
45
45
46 ## If this value is another class instance
46 ## If this value is another class instance
47 myNewDict = obj2Dict(thisValue)
47 myDict[thisKey] = obj2Dict(thisValue)
48 myDict[thisKey] = myNewDict
49
48
50 return myDict
49 return myDict
51
50
General Comments 0
You need to be logged in to leave comments. Login now