fixing bugs introduced by last commit
This commit is contained in:
parent
a2f6976d6d
commit
566ce8ca4e
|
@ -1193,7 +1193,7 @@ def dict2class(d,recursive=True,cleanNames=True):
|
||||||
"""Return a class that has same attributes/values and
|
"""Return a class that has same attributes/values and
|
||||||
dictionaries key/value
|
dictionaries key/value
|
||||||
"""
|
"""
|
||||||
|
if not isinstance(d,dict): return None
|
||||||
#define a dummy class
|
#define a dummy class
|
||||||
c = dropObject()
|
c = dropObject()
|
||||||
for elem in d.keys():
|
for elem in d.keys():
|
||||||
|
@ -1204,7 +1204,7 @@ def dict2class(d,recursive=True,cleanNames=True):
|
||||||
key = "value%s" % elem
|
key = "value%s" % elem
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
if recursive and (type(d[elem]) == types.DictType):
|
if recursive and isinstance(d[elem],dict):
|
||||||
c.__dict__[key] = dict2class(d[elem])
|
c.__dict__[key] = dict2class(d[elem])
|
||||||
else:
|
else:
|
||||||
c.__dict__[key] = d[elem]
|
c.__dict__[key] = d[elem]
|
||||||
|
|
Loading…
Reference in New Issue