fixing bugs introduced by last commit

This commit is contained in:
Marco Cammarata 2016-09-28 09:55:12 +02:00
parent a2f6976d6d
commit 566ce8ca4e
1 changed files with 2 additions and 2 deletions

View File

@ -1193,7 +1193,7 @@ def dict2class(d,recursive=True,cleanNames=True):
"""Return a class that has same attributes/values and
dictionaries key/value
"""
if not isinstance(d,dict): return None
#define a dummy class
c = dropObject()
for elem in d.keys():
@ -1204,7 +1204,7 @@ def dict2class(d,recursive=True,cleanNames=True):
key = "value%s" % elem
except:
pass
if recursive and (type(d[elem]) == types.DictType):
if recursive and isinstance(d[elem],dict):
c.__dict__[key] = dict2class(d[elem])
else:
c.__dict__[key] = d[elem]