##// 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 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 18 def isDictFormat(thisValue):
19 19
@@ -39,13 +39,12 def obj2Dict(myObj, keyList=[]):
39 39 if thisKey not in keyList:
40 40 continue
41 41
42 if isNotClassVar(thisValue):
42 if not isObject(thisValue):
43 43 myDict[thisKey] = thisValue
44 44 continue
45 45
46 46 ## If this value is another class instance
47 myNewDict = obj2Dict(thisValue)
48 myDict[thisKey] = myNewDict
47 myDict[thisKey] = obj2Dict(thisValue)
49 48
50 49 return myDict
51 50
General Comments 0
You need to be logged in to leave comments. Login now