Kleine Anpassungen

This commit is contained in:
2025-07-27 19:41:04 +02:00
parent d91c19fe8c
commit 078f705c5d
2 changed files with 6 additions and 6 deletions
+4 -4
View File
@@ -3,7 +3,8 @@ from pathlib import Path
from sys import platform from sys import platform
from typing import Tuple, Type from typing import Tuple, Type
from pydantic import Field from pydantic import Field
from pydantic_yaml import to_yaml_str, parse_yaml_file_as from pydantic_yaml import to_yaml_str
from ruamel.yaml import YAML
from enum import Enum from enum import Enum
import logging import logging
@@ -166,7 +167,7 @@ class AppSettings(BaseSettings):
app_settings = AppSettings() app_settings = AppSettings()
class Xml(BaseModel): class XmlFile(BaseModel):
xml: Path xml: Path
@@ -175,7 +176,7 @@ class XslFile(BaseModel):
bez: str bez: str
xsl_file: Path xsl_file: Path
xslt_params: dict[str, str] = {} xslt_params: dict[str, str] = {}
xmls: list[Xml] = [] xmls: list[XmlFile] = []
class TreeNode(BaseModel): class TreeNode(BaseModel):
@@ -197,7 +198,6 @@ class PdfProjectSettings(BaseModel):
# Explizit UTF-8 Encoding verwenden # Explizit UTF-8 Encoding verwenden
project_yaml_path = project_dir / "project.yaml" project_yaml_path = project_dir / "project.yaml"
with open(project_yaml_path, 'r', encoding='utf-8') as f: with open(project_yaml_path, 'r', encoding='utf-8') as f:
from ruamel.yaml import YAML
yaml = YAML(typ='safe') yaml = YAML(typ='safe')
yaml_data = yaml.load(f) yaml_data = yaml.load(f)
return cls.model_validate(yaml_data) return cls.model_validate(yaml_data)
+2 -2
View File
@@ -1,4 +1,4 @@
from conf import TreeNode, XslFile, PdfProjectSettings, Xml from conf import TreeNode, XslFile, PdfProjectSettings, XmlFile
from pathlib import Path from pathlib import Path
from pydantic_yaml import to_yaml_str, parse_yaml_file_as from pydantic_yaml import to_yaml_str, parse_yaml_file_as
@@ -36,7 +36,7 @@ for r1 in ebene_1.rows(named=True):
id=(r3["reporttyp"], r3["report"], r3["repfile"]), id=(r3["reporttyp"], r3["report"], r3["repfile"]),
bez=r3["repfile_bez"], bez=r3["repfile_bez"],
xsl_file=Path(r3["xsl_datei"]), xsl_file=Path(r3["xsl_datei"]),
xmls=[Xml(xml=Path("test.xml"))], xmls=[XmlFile(xml=Path("test.xml"))],
) )
tn_2.children.append(x) tn_2.children.append(x)