From 02b754d14042b95028b08a4fbd14c38fd9e63f5a Mon Sep 17 00:00:00 2001 From: Tyler Madonna Date: Tue, 13 Feb 2024 16:58:01 -0500 Subject: [PATCH] Reverting changes to get absolute path --- src/routes/entity_CRUD/__init__.py | 2 +- src/routes/entity_CRUD/ingest_file_helper.py | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/routes/entity_CRUD/__init__.py b/src/routes/entity_CRUD/__init__.py index 9adade54..afdecfb7 100644 --- a/src/routes/entity_CRUD/__init__.py +++ b/src/routes/entity_CRUD/__init__.py @@ -843,7 +843,7 @@ def publish_datastage(identifier): abort_bad_req(f"{dataset_uuid} missing contacts or contributors. Must have at least one of each") ingest_helper = IngestFileHelper(current_app.config) - ds_path = ingest_helper.get_dataset_directory_absolute_path(entity_dict, dataset_group_uuid, dataset_uuid, False) + ds_path = ingest_helper.dataset_directory_absolute_path(dataset_data_access_level, dataset_group_uuid, dataset_uuid, False) md_file = os.path.join(ds_path, "metadata.json") json_object = entity_json_dumps(entity, auth_tokens, entity_instance) diff --git a/src/routes/entity_CRUD/ingest_file_helper.py b/src/routes/entity_CRUD/ingest_file_helper.py index 5c36c36d..c9bf8fc2 100644 --- a/src/routes/entity_CRUD/ingest_file_helper.py +++ b/src/routes/entity_CRUD/ingest_file_helper.py @@ -28,7 +28,7 @@ def make_directory(new_file_path, symbolic_file_path=None): def dataset_asset_directory_absolute_path(self, dataset_uuid): return file_helper.ensureTrailingSlashURL(self.appconfig['SENNET_WEBSERVICE_FILEPATH']) + dataset_uuid - def get_dataset_directory_absolute_path(self, dataset_record, group_uuid, dataset_uuid, published=False): + def get_dataset_directory_absolute_path(self, dataset_record, group_uuid, dataset_uuid): if dataset_record['contains_human_genetic_sequences']: access_level = self.appconfig['ACCESS_LEVEL_PROTECTED'] elif not 'data_access_level' in dataset_record: @@ -40,9 +40,9 @@ def get_dataset_directory_absolute_path(self, dataset_record, group_uuid, datase if 'status' in dataset_record and dataset_record['status'] == 'Published': published = True - return self.__dataset_directory_absolute_path(access_level, group_uuid, dataset_uuid, published) + return self.dataset_directory_absolute_path(access_level, group_uuid, dataset_uuid, published) - def __dataset_directory_absolute_path(self, access_level, group_uuid, dataset_uuid, published): + def dataset_directory_absolute_path(self, access_level, group_uuid, dataset_uuid, published): grp_name = AuthHelper.getGroupDisplayName(group_uuid) if access_level == 'protected': base_dir = self.appconfig['GLOBUS_PROTECTED_ENDPOINT_FILEPATH'] @@ -175,12 +175,12 @@ def set_dir_permissions(self, access_level, file_path, published=False, trial_ru self.logger.error(e, exc_info=True) def move_dataset_files_for_publishing(self, uuid, group_uuid, dataset_access_level, trial_run=False): - from_path = self.__dataset_directory_absolute_path(dataset_access_level, group_uuid, uuid, False) + from_path = self.dataset_directory_absolute_path(dataset_access_level, group_uuid, uuid, False) if not os.path.isdir(from_path): raise HTTPException(f"{uuid}: path not found to dataset will not publish, path is {from_path}", 500) data_access_level = 'protected' if not dataset_access_level == 'protected': data_access_level = 'public' - to_path = self.__dataset_directory_absolute_path(data_access_level, group_uuid, uuid, True) + to_path = self.dataset_directory_absolute_path(data_access_level, group_uuid, uuid, True) if not trial_run: shutil.move(from_path, to_path) else: @@ -204,7 +204,7 @@ def create_upload_directory(self, group_uuid, upload_uuid): self.logger.error(e, exc_info=True) def set_dataset_permissions(self, dataset_uuid, group_uuid, dataset_access_level, published, trial_run=False): - file_path = self.__dataset_directory_absolute_path(dataset_access_level, group_uuid, dataset_uuid, published) + file_path = self.dataset_directory_absolute_path(dataset_access_level, group_uuid, dataset_uuid, published) return self.set_dir_permissions(dataset_access_level, file_path, published, trial_run=trial_run) def relink_to_public(self, dataset_uuid):