details:
http://www.bx.psu.edu/hg/galaxy/rev/54be726b7711
changeset: 2389:54be726b7711
user: Dan Blankenberg <dan(a)bx.psu.edu>
date: Thu Apr 30 15:37:37 2009 -0400
description:
Fix for HID incrementing by two when importing from a library.
2 file(s) affected in this change:
lib/galaxy/model/__init__.py
lib/galaxy/web/controllers/library.py
diffs (44 lines):
diff -r ff2fca65799e -r 54be726b7711 lib/galaxy/model/__init__.py
--- a/lib/galaxy/model/__init__.py Thu Apr 30 11:07:34 2009 -0400
+++ b/lib/galaxy/model/__init__.py Thu Apr 30 15:37:37 2009 -0400
@@ -777,8 +777,7 @@
self.copied_from_library_dataset_dataset_association =
copied_from_library_dataset_dataset_association
self.library_dataset = library_dataset
self.user = user
- def to_history_dataset_association( self, target_history, parent_id=None ):
- hid = target_history._next_hid()
+ def to_history_dataset_association( self, target_history, parent_id = None,
add_to_history = False ):
hda = HistoryDatasetAssociation( name=self.name,
info=self.info,
blurb=self.blurb,
@@ -790,12 +789,13 @@
deleted=self.deleted,
parent_id=parent_id,
copied_from_library_dataset_dataset_association=self,
- history=target_history,
- hid=hid )
+ history=target_history )
hda.flush()
hda.metadata = self.metadata #need to set after flushed, as MetadataFiles require
dataset.id
+ if add_to_history and target_history:
+ target_history.add_dataset( hda )
for child in self.children:
- child_copy = child.to_history_dataset_association(
target_history=target_history, parent_id=hda.id )
+ child_copy = child.to_history_dataset_association( target_history =
target_history, parent_id = hda.id, add_to_history = False )
if not self.datatype.copy_safe_peek:
hda.set_peek() #in some instances peek relies on dataset_id, i.e. gmaj.zip
for viewing MAFs
hda.flush()
diff -r ff2fca65799e -r 54be726b7711 lib/galaxy/web/controllers/library.py
--- a/lib/galaxy/web/controllers/library.py Thu Apr 30 11:07:34 2009 -0400
+++ b/lib/galaxy/web/controllers/library.py Thu Apr 30 15:37:37 2009 -0400
@@ -175,9 +175,7 @@
history = trans.get_history()
for ldda_id in ldda_ids:
ldda = trans.app.model.LibraryDatasetDatasetAssociation.get( ldda_id )
- hda = ldda.to_history_dataset_association( target_history=history )
- history.add_dataset( hda )
- hda.flush()
+ hda = ldda.to_history_dataset_association( target_history=history,
add_to_history = True )
history.flush()
msg = "%i dataset(s) have been imported into your history" % len(
ldda_ids )
return trans.response.send_redirect( web.url_for(
controller='library',