From 92e95fd70a73580608dfeb71ed0c0bd7ff6ff812 Mon Sep 17 00:00:00 2001 From: Assunta DeSanto Date: Wed, 18 Nov 2020 13:56:20 -0500 Subject: [PATCH 1/2] changed copy_tags to an array in copy_tags_to and added copy_tags parameter in copy call --- lib/galaxy/model/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/model/__init__.py b/lib/galaxy/model/__init__.py index b2b52532828..d58e7e7f319 100644 --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -3223,6 +3223,7 @@ class HistoryDatasetAssociation(DatasetInstance, HasTags, Dictifiable, UsesAnnot flush=False) # update init non-keywords as well hda.purged = self.purged + hda.copy_tags_to(copy_tags) object_session(self).add(hda) hda.metadata = self.metadata @@ -3236,7 +3237,7 @@ class HistoryDatasetAssociation(DatasetInstance, HasTags, Dictifiable, UsesAnnot def copy_tags_to(self, copy_tags=None): if copy_tags is not None: - for tag in copy_tags.values(): + for tag in copy_tags: copied_tag = tag.copy(cls=HistoryDatasetAssociationTagAssociation) self.tags.append(copied_tag) @@ -4655,7 +4656,7 @@ class DatasetCollectionElement(Dictifiable, RepresentById): flush=flush ) else: - new_element_object = element_object.copy(flush=flush) + new_element_object = element_object.copy(flush=flush, copy_tags=element_object.tags) new_element_object.visible = False if destination is not None and element_object.hidden_beneath_collection_instance: new_element_object.hidden_beneath_collection_instance = destination From 012f9c1332d122f9f60c296e733a67f35a5de7d3 Mon Sep 17 00:00:00 2001 From: Assunta DeSanto Date: Wed, 18 Nov 2020 15:11:11 -0500 Subject: [PATCH 2/2] fixing a test and other use case of copy_tags_to --- lib/galaxy/tools/actions/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/galaxy/tools/actions/__init__.py b/lib/galaxy/tools/actions/__init__.py index acbe2ccd7b0..e1e775b41b1 100644 --- a/lib/galaxy/tools/actions/__init__.py +++ b/lib/galaxy/tools/actions/__init__.py @@ -413,7 +413,7 @@ class DefaultToolAction: trans.sa_session.add(data) if not completed_job: trans.app.security_agent.set_all_dataset_permissions(data.dataset, output_permissions, new=True, flush=False) - data.copy_tags_to(preserved_tags) + data.copy_tags_to(preserved_tags.values()) if not completed_job and trans.app.config.legacy_eager_objectstore_initialization: # Must flush before setting object store id currently.