Update HDA API return value to reflect new API-based path for downloads.

This commit is contained in:
John Chilton
2013-02-26 09:56:15 -06:00
parent 5e36c3f50f
commit 4fee46f0ef
@@ -155,7 +155,7 @@ class HistoryContentsController( BaseAPIController, UsesHistoryDatasetAssociatio
@web.expose_api
def show( self, trans, id, history_id, **kwd ):
"""
GET /api/histories/{encoded_history_id}/contents/{encoded_content_id}
GET /api/histories/{encoded_history_id}/contents/{encoded_content_id}/display
Displays information about a history content (dataset).
"""
hda_dict = {}
@@ -230,14 +230,7 @@ def get_hda_dict( trans, history, hda, for_editing ):
hda_dict[ 'file_name' ] = hda.file_name
if not hda_dict[ 'deleted' ]:
# Problem: Method url_for cannot use the dataset controller
# Get the environment from DefaultWebTransaction
# and use default webapp mapper instead of webapp API mapper
web_url_for = routes.URLGenerator( trans.webapp.mapper, trans.environ )
# http://routes.groovie.org/generating.html
# url_for is being phased out, so new applications should use url
hda_dict[ 'download_url' ] = web_url_for( controller='dataset', action='display',
dataset_id=trans.security.encode_id( hda.id ), to_ext=hda.ext )
hda_dict[ 'download_url' ] = url_for( 'history_contents_display', history_id = trans.security.encode_id( history.id ), history_content_id = trans.security.encode_id( hda.id ) )
can_access_hda = trans.app.security_agent.can_access_dataset( trans.get_current_user_roles(), hda.dataset )
hda_dict[ 'accessible' ] = ( trans.user_is_admin() or can_access_hda )