diff --git a/mcutils.py b/mcutils.py index 94e2085..48882a6 100644 --- a/mcutils.py +++ b/mcutils.py @@ -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]