Get user's home dir from environment

mypy and pre commit
This commit is contained in:
mike cullerton 2022-09-19 08:59:07 -04:00
parent a27434ef90
commit 52e6cf0c27
1 changed files with 11 additions and 5 deletions

View File

@ -5,8 +5,6 @@ from spiffworkflow_backend import create_app
from spiffworkflow_backend.services.process_model_service import ProcessModelService
from spiffworkflow_backend.services.spec_file_service import SpecFileService
from lxml.etree import Element as EtreeElement
def main():
"""Main."""
@ -14,14 +12,18 @@ def main():
flask_env_key = "FLASK_SESSION_SECRET_KEY"
os.environ[flask_env_key] = "whatevs"
home = os.environ["HOME"]
os.environ["BPMN_SPEC_ABSOLUTE_DIR"] = f"{home}/projects/github/sartography/sample-process-models"
os.environ[
"BPMN_SPEC_ABSOLUTE_DIR"
] = f"{home}/projects/github/sartography/sample-process-models"
app = create_app()
with app.app_context():
no_primary = []
process_models = ProcessModelService().get_process_models()
for process_model in process_models:
if process_model.primary_file_name:
files = SpecFileService.get_files(process_model, extension_filter="bpmn")
files = SpecFileService.get_files(
process_model, extension_filter="bpmn"
)
if len(files) == 1:
# print(f"primary_file_name: {process_model.primary_file_name}")
bpmn_xml_file_contents = SpecFileService.get_data(
@ -43,7 +45,11 @@ def main():
# ProcessModelService().update_spec(
# process_model, attributes_to_update
# )
SpecFileService.update_file(process_model, process_model.primary_file_name, bpmn_xml_file_contents)
SpecFileService.update_file(
process_model,
process_model.primary_file_name,
bpmn_xml_file_contents,
)
# except Exception:
# print(process_model.id)
else: