From 77a76a7529fa8275640a1c9dc0573bd3acc7e651 Mon Sep 17 00:00:00 2001 From: mike cullerton Date: Mon, 21 Nov 2022 12:05:25 -0500 Subject: [PATCH] use correct separator. --- .../services/file_system_service.py | 9 ++++++++- .../services/process_model_service.py | 5 ++++- .../integration/test_process_api.py | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/file_system_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/file_system_service.py index cbe007d63..523060620 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/file_system_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/file_system_service.py @@ -31,10 +31,17 @@ class FileSystemService: app_root = current_app.root_path return os.path.join(app_root, "..", dir_name) + @staticmethod + def id_string_to_relative_path(id_string): + return id_string.replace("/", os.sep) + @staticmethod def process_group_path(name: str) -> str: """Category_path.""" - return os.path.abspath(os.path.join(FileSystemService.root_path(), name)) + return os.path.abspath(os.path.join( + FileSystemService.root_path(), + FileSystemService.id_string_to_relative_path(name) + )) @staticmethod def full_path_from_relative_path(relative_path: str) -> str: diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_service.py index 0ad302548..25912f5e7 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_service.py @@ -207,7 +207,10 @@ class ProcessModelService(FileSystemService): """Look for a given process_group, and return it.""" if os.path.exists(FileSystemService.root_path()): process_group_path = os.path.abspath( - os.path.join(FileSystemService.root_path(), process_group_id) + os.path.join( + FileSystemService.root_path(), + FileSystemService.id_string_to_relative_path(process_group_id) + ) ) if self.is_group(process_group_path): return self.__scan_process_group(process_group_path) diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_process_api.py b/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_process_api.py index c606ef6e9..31477acf8 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_process_api.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_process_api.py @@ -2384,7 +2384,7 @@ class TestProcessApi(BaseTest): for group in groups: persisted = ProcessModelService().get_process_group(group) assert persisted is not None - assert persisted.id_for_file_path() == group + assert persisted.id == group def test_move_model( self,