From f69d13ef46f63adc31be2c8a3fad5dfab69dd593 Mon Sep 17 00:00:00 2001 From: Greg Von Kuster Date: Fri, 19 Jun 2009 11:21:13 -0400 Subject: [PATCH] Fix for importing history items ( datasets ) that include child datasets into a library. --- lib/galaxy/model/__init__.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/galaxy/model/__init__.py b/lib/galaxy/model/__init__.py index f2bf3cfa344..892d92f5af3 100644 --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -628,7 +628,7 @@ class HistoryDatasetAssociation( DatasetInstance ): hda.set_peek() hda.flush() return hda - def to_library_dataset_dataset_association( self, target_folder, replace_dataset=None, parent_id=None ): + def to_library_dataset_dataset_association( self, target_folder, replace_dataset=None, parent_id=None, user=None ): if replace_dataset: # The replace_dataset param ( when not None ) refers to a LibraryDataset that is being replaced with a new version. library_dataset = replace_dataset @@ -637,6 +637,8 @@ class HistoryDatasetAssociation( DatasetInstance ): # LibraryDataset, and the current user's DefaultUserPermissions will be applied to the associated Dataset. library_dataset = LibraryDataset( folder=target_folder, name=self.name, info=self.info ) library_dataset.flush() + if not user: + user = self.history.user ldda = LibraryDatasetDatasetAssociation( name=self.name, info=self.info, blurb=self.blurb, @@ -649,7 +651,7 @@ class HistoryDatasetAssociation( DatasetInstance ): deleted=self.deleted, parent_id=parent_id, copied_from_history_dataset_association=self, - user=self.history.user ) + user=user ) ldda.flush() # Permissions must be the same on the LibraryDatasetDatasetAssociation and the associated LibraryDataset # Must set metadata after ldda flushed, as MetadataFiles require ldda.id @@ -660,7 +662,10 @@ class HistoryDatasetAssociation( DatasetInstance ): library_dataset.library_dataset_dataset_association_id = ldda.id library_dataset.flush() for child in self.children: - child_copy = child.to_library_dataset_dataset_association( target_folder=target_folder, replace_dataset=replace_dataset, parent_id=ldda.id ) + child_copy = child.to_library_dataset_dataset_association( target_folder=target_folder, + replace_dataset=replace_dataset, + parent_id=ldda.id, + user=ldda.user ) if not self.datatype.copy_safe_peek: # In some instances peek relies on dataset_id, i.e. gmaj.zip for viewing MAFs ldda.set_peek()