Defaultargumente für den Konstruktor, so dass auch keine Pfade übergeben werden können
This commit is contained in:
+10
-7
@@ -8,7 +8,8 @@ Diese Lib verwaltet alle Config dateien (als .cfg oder als .json) von CreoMigrat
|
||||
class TOSGroupsConfig:
|
||||
"""Auslesen der Config Angaben zu den TOS Gruppen"""
|
||||
|
||||
def __init__(self, config_dir, config_file):
|
||||
def __init__(self, config_dir='.', config_file='TOS-Gruppen.json'):
|
||||
|
||||
self.tos_hierarchy = None
|
||||
self.config_path = os.path.join(config_dir, config_file)
|
||||
|
||||
@@ -51,19 +52,21 @@ class TOSGroupsConfig:
|
||||
return ret
|
||||
|
||||
def load_tos_hierarchy(self):
|
||||
"""lade die gegebenen Hierarchy aus dem Config File in eine json Objekt"""
|
||||
"""lade die gegebenen Hierarchy aus dem Config File in ein json Objekt"""
|
||||
with open(self.config_path, 'r', encoding='utf-8') as fh:
|
||||
self.tos_hierarchy = json.loads(fh.read())
|
||||
|
||||
def from_json(self, json_str):
|
||||
"""lade die gegebenen Hierarchy aus einem json String in ein json Objekt"""
|
||||
self.tos_hierarchy = json.loads(json_str)
|
||||
|
||||
|
||||
class MaterialConfig:
|
||||
"""Auslesen der Config Angaben zu allen Materialangaben"""
|
||||
|
||||
config_dir = os.environ.get('CREMIG_CFG')
|
||||
config_path = os.path.join(config_dir, 'Materialübersetzung.json')
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self, config_dir='.', config_file='Materialübersetzung.json'):
|
||||
self.materials = None
|
||||
self.config_path = os.path.join(config_dir, config_file)
|
||||
|
||||
def load_materials(self):
|
||||
"""lade die gegebenen Hierarchy aus dem Config File in eine json Objekt"""
|
||||
@@ -84,4 +87,4 @@ class MaterialConfig:
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
pass
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user