add id_for_file_path helper method for process groups

This commit is contained in:
mike cullerton 2022-11-21 08:36:19 -05:00
parent 1d14ea5da5
commit 79dea88b96
1 changed files with 7 additions and 0 deletions

View File

@ -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."""