From 79dea88b96034e5e463eff1cb727587e9ad83aa1 Mon Sep 17 00:00:00 2001 From: mike cullerton Date: Mon, 21 Nov 2022 08:36:19 -0500 Subject: [PATCH] add id_for_file_path helper method for process groups --- .../src/spiffworkflow_backend/models/process_group.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/process_group.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/process_group.py index 236641e35..c323c1916 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/process_group.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/process_group.py @@ -10,6 +10,8 @@ import marshmallow from marshmallow import post_load from marshmallow import Schema +import os + from spiffworkflow_backend.models.process_model import ProcessModelInfo @@ -47,6 +49,11 @@ class ProcessGroup: original_dict = dataclasses.asdict(self) return {x: original_dict[x] for x in original_dict if x not in ["sort_index"]} + # for use with os.path.join, so it can work on windows + def id_for_file_path(self) -> str: + """Id_for_file_path.""" + return self.id.replace("/", os.sep) + class ProcessGroupSchema(Schema): """ProcessGroupSchema."""