aboutsummaryrefslogtreecommitdiff
path: root/src/hydrilla/server
diff options
context:
space:
mode:
Diffstat (limited to 'src/hydrilla/server')
-rw-r--r--src/hydrilla/server/malcontent.py19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/hydrilla/server/malcontent.py b/src/hydrilla/server/malcontent.py
index ce24330..af925a0 100644
--- a/src/hydrilla/server/malcontent.py
+++ b/src/hydrilla/server/malcontent.py
@@ -120,12 +120,8 @@ class Malcontent:
fmt = _('err.server.malcontent_path_not_dir_{}')
raise HaketiloException(fmt.format(malcontent_dir_path))
- types: t.Iterable[t.Type[item_infos.AnyInfo]] = (
- item_infos.MappingInfo,
- item_infos.ResourceInfo
- )
- for info_type in types:
- type_path = self.malcontent_dir_path / info_type.type_name
+ for type in [item_infos.ItemType.RESOURCE, item_infos.ItemType.MAPPING]:
+ type_path = self.malcontent_dir_path / type.value
if not type_path.is_dir():
continue
@@ -135,7 +131,7 @@ class Malcontent:
for ver_file in subpath.iterdir():
try:
- self._load_item(info_type, ver_file)
+ self._load_item(type, ver_file)
except:
if self.werror:
raise
@@ -174,11 +170,8 @@ class Malcontent:
versioned_info = infos.get(identifier, VersionedItemInfo())
infos[identifier] = versioned_info.register(item_info)
- def _load_item(
- self,
- info_type: t.Type[item_infos.AnyInfo],
- ver_file: Path
- ) -> None:
+ def _load_item(self, type: item_infos.ItemType, ver_file: Path) \
+ -> None:
"""
Reads, validates and autocompletes serveable mapping/resource
definition, then registers information from it in data structures.
@@ -186,7 +179,7 @@ class Malcontent:
version = versions.parse(ver_file.name)
identifier = ver_file.parent.name
- item_info = info_type.load(ver_file)
+ item_info = type.info_class.load(ver_file)
if item_info.identifier != identifier:
fmt = _('err.server.item_{item}_in_file_{file}')