# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Greg Von Kuster <greg(a)bx.psu.edu>
# Date 1275503088 14400
# Node ID ea2658d131b4c54fca14cdf2b5a66fbf128eaf40
# Parent cea1569d9efd3f89188f455e9eb101ac3ce48594
Fix for LibraryDatasetDatasetAssociation objects when created by importing a history item iinto a library, the copied_from_history_dataset_association_id will now be kept.
Add a get_display_name() method to the LibraryDatasetDatasetAssociation class.
Fix for the test_forms_and_requests.py functional test script, purge all created libraries created during the tests so following test runs will test correctly.
--- a/lib/galaxy/model/__init__.py
+++ b/lib/galaxy/model/__init__.py
@@ -932,7 +932,7 @@ class LibraryFolder( object ):
return [ ld for ld in self.datasets if not ld.library_dataset_dataset_association.dataset.deleted ]
@property
def active_datasets( self ):
- # This needs to be a list
+ # This needs to be a list
return [ ld.library_dataset_dataset_association.dataset for ld in self.datasets if not ld.library_dataset_dataset_association.deleted ]
def get_display_name( self ):
# Library folder name can be either a string or a unicode object. If string,
@@ -997,8 +997,10 @@ class LibraryDatasetDatasetAssociation(
# FIXME: sa_session is must be passed to DataSetInstance if the create_dataset
# parameter in kwd is True so that the new object can be flushed. Is there a better way?
DatasetInstance.__init__( self, sa_session=sa_session, **kwd )
- self.copied_from_history_dataset_association = copied_from_history_dataset_association
- self.copied_from_library_dataset_dataset_association = copied_from_library_dataset_dataset_association
+ if copied_from_history_dataset_association:
+ self.copied_from_history_dataset_association_id = copied_from_history_dataset_association.id
+ if copied_from_library_dataset_dataset_association:
+ self.copied_from_library_dataset_dataset_association_id = copied_from_library_dataset_dataset_association.id
self.library_dataset = library_dataset
self.user = user
def to_history_dataset_association( self, target_history, parent_id = None, add_to_history = False ):
@@ -1085,6 +1087,15 @@ class LibraryDatasetDatasetAssociation(
else:
return template.get_widgets( trans.user )
return []
+ def get_display_name( self ):
+ """
+ LibraryDatasetDatasetAssociation name can be either a string or a unicode object.
+ If string, convert to unicode object assuming 'utf-8' format.
+ """
+ ldda_name = self.name
+ if isinstance( ldda_name, str ):
+ ldda_name = unicode( ldda_name, 'utf-8' )
+ return ldda_name
class LibraryInfoAssociation( object ):
def __init__( self, library, form_definition, info, inheritable=False ):
--- a/test/functional/test_forms_and_requests.py
+++ b/test/functional/test_forms_and_requests.py
@@ -382,6 +382,16 @@ class TestFormsAndRequests( TwillTestCas
sa_session.delete( a )
sa_session.flush()
##################
+ # Purge all libraries
+ ##################
+ for library in [ library_one ]:
+ self.delete_library_item( 'library_admin',
+ self.security.encode_id( library.id ),
+ self.security.encode_id( library.id ),
+ library.name,
+ item_type='library' )
+ self.purge_library( self.security.encode_id( library.id ), library.name )
+ ##################
# Eliminate all non-private roles
##################
for role in [ role_one, role_two ]: