diff --git a/lib/manage_configs.py b/lib/manage_configs.py index cbf8d61..62c891a 100644 --- a/lib/manage_configs.py +++ b/lib/manage_configs.py @@ -10,8 +10,10 @@ Diese Lib verwaltet alle Config dateien (als .cfg oder als .json) von CreoMigrat """ class JsonBasedConfig: """Klasse mit generellen Methoden für alle Config Objekte mit json files""" - def __init__(self, config_dir, config_file): + def __init__(self, config_dir: str, config_file: str): """merke dir den Pfad zu den Configdateien""" + self._config_dir = config_dir + self._config_file = config_file self._config_path = os.path.join(config_dir, config_file) def load_json_from_file(self): @@ -41,7 +43,7 @@ class CSVBasedConfig: class SivasAssemblyData(JsonBasedConfig): """Auslesen der Assembly-Informationen zu einer angegebenen Baugruppennummer""" - def __init__(self, config_dir, config_file, load_local_json=False): + def __init__(self, config_dir: str, config_file: str, load_local_json=False): super().__init__(config_dir, config_file) self._load_local_json = load_local_json self._asm_data = None @@ -55,7 +57,7 @@ class SivasAssemblyData(JsonBasedConfig): def create_asm_json(self): """Erstellt JSON mit den aktuellen Baugruppeninformationen""" try: - update_database.get_sivas_dbase(self._config_path, os.environ.get("CREMIG_DATA")) + update_database.get_sivas_dbase(self._config_file.removesuffix(".json")) except: raise ValueError("JSON-Datei mit Baugruppeninformationen konnte nicht erstellt werden!")