This commit is contained in:
@@ -13,7 +13,7 @@ class ModuleConfigError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class ModuleMeta(object):
|
||||
class ModuleMeta:
|
||||
_json_file = 'module.json'
|
||||
_root_url_name = 'root'
|
||||
|
||||
@@ -73,7 +73,7 @@ class ModuleMeta(object):
|
||||
return d
|
||||
|
||||
|
||||
class ModuleConfig(object):
|
||||
class ModuleConfig:
|
||||
_lazy_load = True
|
||||
|
||||
def __init__(self, config_file_path=None, django_base_dir=None):
|
||||
@@ -83,7 +83,7 @@ class ModuleConfig(object):
|
||||
config_file_path = os.path.join(django_base_dir, DJANGO_MAIN_MODULE, MODULE_CONFIG_FILE_NAME)
|
||||
self._config_file_path = config_file_path
|
||||
|
||||
self._modules = dict()
|
||||
self._modules = {}
|
||||
|
||||
self._loaded = False
|
||||
if not self._lazy_load:
|
||||
@@ -96,13 +96,13 @@ class ModuleConfig(object):
|
||||
def _load(self):
|
||||
path = self._config_file_path
|
||||
|
||||
self._modules = dict()
|
||||
self._modules = {}
|
||||
|
||||
if os.path.exists(path):
|
||||
with open(path, 'r') as f:
|
||||
with open(path, 'r', encoding='ascii') as f:
|
||||
data = json.load(f)
|
||||
else:
|
||||
data = dict()
|
||||
data = {}
|
||||
|
||||
if 'modules' in data:
|
||||
for meta_dict in data['modules']:
|
||||
@@ -131,5 +131,5 @@ class ModuleConfig(object):
|
||||
for meta_obj in self._modules.values():
|
||||
data['modules'].append(meta_obj.dump_as_dict())
|
||||
|
||||
with open(path, 'w') as f:
|
||||
with open(path, 'w', encoding='ascii') as f:
|
||||
json.dump(data, f, indent=4)
|
||||
|
||||
Reference in New Issue
Block a user