[hg] galaxy 3729: Bug fixes for history import: (a) import can n...
details: http://www.bx.psu.edu/hg/galaxy/rev/a367a7cd53bb changeset: 3729:a367a7cd53bb user: jeremy goecks <jeremy.goecks@emory.edu> date: Sun May 02 15:34:41 2010 -0400 description: Bug fixes for history import: (a) import can now be used by users who have access via sharing and (b) import changes the current history to the imported history. Functional tests updated to reflect new functionality and error messages. diffstat: lib/galaxy/web/controllers/history.py | 9 +++------ test/functional/test_history_functions.py | 9 +++++++-- 2 files changed, 10 insertions(+), 8 deletions(-) diffs (56 lines): diff -r 3ac0dfcdf44e -r a367a7cd53bb lib/galaxy/web/controllers/history.py --- a/lib/galaxy/web/controllers/history.py Fri Apr 30 18:26:49 2010 -0400 +++ b/lib/galaxy/web/controllers/history.py Sun May 02 15:34:41 2010 -0400 @@ -513,7 +513,6 @@ """Import another user's history via a shared URL""" msg = "" user = trans.get_user() - user_history = trans.get_history() # Set referer message if 'referer' in kwd: referer = kwd['referer'] @@ -527,11 +526,9 @@ # Do import. if not id: return trans.show_error_message( "You must specify a history you want to import.<br>You can %s." % referer_message, use_panels=True ) - import_history = self.get_history( trans, id, check_ownership=False ) + import_history = self.get_history( trans, id, check_ownership=False, check_accessible=True ) if not import_history: return trans.show_error_message( "The specified history does not exist.<br>You can %s." % referer_message, use_panels=True ) - if not import_history.importable: - return trans.show_error_message( "The owner of this history has disabled imports via this link.<br>You can %s." % referer_message, use_panels=True ) if user: if import_history.user_id == user.id: return trans.show_error_message( "You cannot import your own history.<br>You can %s." % referer_message, use_panels=True ) @@ -548,8 +545,8 @@ new_history.add_galaxy_session( galaxy_session, association=association ) trans.sa_session.add( new_history ) trans.sa_session.flush() - if not user_history.datasets: - trans.set_history( new_history ) + # Set imported history to be user's current history. + trans.set_history( new_history ) return trans.show_ok_message( message="""History "%s" has been imported. <br>You can <a href="%s">start using this history</a> or %s.""" % ( new_history.name, web.url_for( '/' ), referer_message ), use_panels=True ) diff -r 3ac0dfcdf44e -r a367a7cd53bb test/functional/test_history_functions.py --- a/test/functional/test_history_functions.py Fri Apr 30 18:26:49 2010 -0400 +++ b/test/functional/test_history_functions.py Sun May 02 15:34:41 2010 -0400 @@ -196,10 +196,15 @@ self.disable_access_via_link( self.security.encode_id( history3.id ), check_str='Anyone can view and import this history', check_str_after_submit='Make History Accessible via Link' ) - # Try importing history3 after disabling access via link. + # Try importing history3 after disabling access via link. To do this, need to login as regular user 2, who cannot access + # history via sharing or via link. + self.logout() + self.login( email=regular_user2.email ) self.import_history_via_url( self.security.encode_id( history3.id ), admin_user.email, - check_str_after_submit='The owner of this history has disabled imports via this link.' ) + check_str_after_submit='History is not accessible to current user' ) + self.logout() + self.login( email=admin_user.email ) # Test sharing history3 with an invalid user self.share_current_history( 'jack@jill.com', check_str_after_submit='jack@jill.com is not a valid Galaxy user.' )
participants (1)
-
Nate Coraor