Commit 6614f362 authored by ibuler's avatar ibuler

[Update] 修改配置文件加载

parent ecc70110
...@@ -212,8 +212,8 @@ class Config(dict): ...@@ -212,8 +212,8 @@ class Config(dict):
if self.root_path: if self.root_path:
filename = os.path.join(self.root_path, filename) filename = os.path.join(self.root_path, filename)
try: try:
with open(filename) as json_file: with open(filename) as f:
obj = yaml.load(json_file) obj = yaml.load(f)
except IOError as e: except IOError as e:
if silent and e.errno in (errno.ENOENT, errno.EISDIR): if silent and e.errno in (errno.ENOENT, errno.EISDIR):
return False return False
...@@ -221,8 +221,7 @@ class Config(dict): ...@@ -221,8 +221,7 @@ class Config(dict):
raise raise
if obj: if obj:
return self.from_mapping(obj) return self.from_mapping(obj)
else: return True
return False
def from_mapping(self, *mapping, **kwargs): def from_mapping(self, *mapping, **kwargs):
"""Updates the config like :meth:`update` ignoring items with non-upper """Updates the config like :meth:`update` ignoring items with non-upper
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment