From 566ce8ca4e3b4789f0e9f56d39628d370706d52f Mon Sep 17 00:00:00 2001 From: Marco Cammarata Date: Wed, 28 Sep 2016 09:55:12 +0200 Subject: [PATCH] fixing bugs introduced by last commit --- mcutils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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]