Skip to content
Snippets Groups Projects
Verified Commit 2423efd7 authored by Daniel Hornung's avatar Daniel Hornung
Browse files

ENH: Making missing paths.

parent c0b27ba5
No related branches found
No related tags found
2 merge requests!100WIP: Filling XLSX: Seems to be working.,!93Filling XLSX: Everything except multiple choice.
Pipeline #48275 passed
This commit is part of merge request !93. Comments created here will be created in the context of that merge request.
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
from __future__ import annotations from __future__ import annotations
import json import json
import pathlib
from collections import OrderedDict from collections import OrderedDict
from types import SimpleNamespace from types import SimpleNamespace
from typing import Any, Dict, List, Optional, Union, TextIO from typing import Any, Dict, List, Optional, Union, TextIO
...@@ -358,4 +359,7 @@ validation_schema: dict, optional ...@@ -358,4 +359,7 @@ validation_schema: dict, optional
result_wb = load_workbook(template) result_wb = load_workbook(template)
template_filler = TemplateFiller(result_wb) template_filler = TemplateFiller(result_wb)
template_filler.fill_data(data=data) template_filler.fill_data(data=data)
parentpath = pathlib.Path(result).parent
parentpath.mkdir(parents=True, exist_ok=True)
result_wb.save(result) result_wb.save(result)
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
""" """
This module allows to generate template tables from JSON schemas. This module allows to generate template tables from JSON schemas.
""" """
import pathlib
import re import re
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
from enum import Enum from enum import Enum
...@@ -279,6 +281,8 @@ class XLSXTemplateGenerator(TableTemplateGenerator): ...@@ -279,6 +281,8 @@ class XLSXTemplateGenerator(TableTemplateGenerator):
""" """
sheets = self._generate_sheets_from_schema(schema, foreign_keys) sheets = self._generate_sheets_from_schema(schema, foreign_keys)
wb = self._create_workbook_from_sheets_def(sheets) wb = self._create_workbook_from_sheets_def(sheets)
parentpath = pathlib.Path(filepath).parent
parentpath.mkdir(parents=True, exist_ok=True)
wb.save(filepath) wb.save(filepath)
@staticmethod @staticmethod
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment