This commit is contained in:
yumoqing 2020-06-07 21:40:44 +08:00
parent 0709801c0e
commit 82b268d935

View File

@ -22,8 +22,6 @@ class JsonObject(DictObject):
JsonObject class load json from a json file JsonObject class load json from a json file
""" """
def __init__(self,jsonholder,keytype='ansi',NS=None): def __init__(self,jsonholder,keytype='ansi',NS=None):
self.__jsonholder__ = jsonholder
self.NS = NS
jhtype = type(jsonholder) jhtype = type(jsonholder)
if jhtype == type("") or jhtype == type(u''): if jhtype == type("") or jhtype == type(u''):
f = open(jsonholder,'r') f = open(jsonholder,'r')
@ -38,10 +36,12 @@ class JsonObject(DictObject):
if type(jsonholder) == type(""): if type(jsonholder) == type(""):
f.close() f.close()
if self.NS is not None: if NS is not None:
ac = ArgsConvert('$[',']$') ac = ArgsConvert('$[',']$')
a = ac.convert(a,self.NS) a = ac.convert(a,self.NS)
DictObject.__init__(self,**a) a['__jsonholder__'] = jsonholder
a['NS'] = NS
DictObject.__init__(self,a)
@SingletonDecorator @SingletonDecorator
class JsonConfig(JsonObject): class JsonConfig(JsonObject):