bugfix
This commit is contained in:
parent
2a547e065c
commit
a5e581af58
@ -1,5 +1,6 @@
|
|||||||
import json
|
import json
|
||||||
from json import JSONEncoder
|
from json import JSONEncoder
|
||||||
|
from inspect import ismethod, isfunction, isbuiltin, isabstract
|
||||||
|
|
||||||
def multiDict2Dict(md):
|
def multiDict2Dict(md):
|
||||||
ns = {}
|
ns = {}
|
||||||
@ -72,17 +73,22 @@ class DictObject:
|
|||||||
|
|
||||||
def to_dict(self):
|
def to_dict(self):
|
||||||
d = self._addon()
|
d = self._addon()
|
||||||
return self.dict_to_dict(d)
|
newd = self.dict_to_dict(d)
|
||||||
|
return newd
|
||||||
|
|
||||||
def dict_to_dict(self,dic):
|
def dict_to_dict(self,dic):
|
||||||
d = {}
|
d = {}
|
||||||
for k,v in dic:
|
for k,v in dic.items():
|
||||||
if isisntance(v,DictObject):
|
if isinstance(v,DictObject):
|
||||||
d[k] = v.to_dict()
|
d[k] = v.to_dict()
|
||||||
elif isinstance(v,dict):
|
elif isinstance(v,dict):
|
||||||
d[k] = self.dict_to_dict(v)
|
d[k] = self.dict_to_dict(v)
|
||||||
elif isinsance(v,list):
|
elif isinstance(v,list):
|
||||||
d[k] = self.array_to_dict(v)
|
d[k] = self.array_to_dict(v)
|
||||||
|
elif k == '__builtins__':
|
||||||
|
pass
|
||||||
|
elif isbuiltin(v) or isfunction(v) or ismethod(v) or isabstract(v):
|
||||||
|
pass
|
||||||
else:
|
else:
|
||||||
d[k] = v
|
d[k] = v
|
||||||
return d
|
return d
|
||||||
@ -96,6 +102,8 @@ class DictObject:
|
|||||||
r.append(self.dict_to_dict(i))
|
r.append(self.dict_to_dict(i))
|
||||||
elif isinstance(i,DictObject):
|
elif isinstance(i,DictObject):
|
||||||
r.append(i.to_dict())
|
r.append(i.to_dict())
|
||||||
|
elif isbuiltin(i) or isfunction(i) or ismethod(i) or isabstract(i):
|
||||||
|
pass
|
||||||
else:
|
else:
|
||||||
r.append(i)
|
r.append(i)
|
||||||
return r
|
return r
|
||||||
|
Loading…
Reference in New Issue
Block a user