UsesHDA: fix new-style display apps; documentation

This commit is contained in:
Carl Eberhard
2013-03-28 11:21:23 -04:00
parent 2c70f8c2bf
commit 1f13e1017f
+9 -4
View File
@@ -332,6 +332,8 @@ class UsesHistoryDatasetAssociationMixin:
return None
def get_hda_dict( self, trans, hda ):
"""Return full details of this HDA in dictionary form.
"""
hda_dict = hda.get_api_value( view='element' )
history = hda.history
hda_dict[ 'api_type' ] = "file"
@@ -341,9 +343,10 @@ class UsesHistoryDatasetAssociationMixin:
can_access_hda = ( trans.user_is_admin() or can_access_hda )
hda_dict[ 'accessible' ] = can_access_hda
# return here if deleted and purged or can't access
# ---- return here if deleted AND purged OR can't access
purged = ( hda.purged or hda.dataset.purged )
if ( hda.deleted and purged ) or not can_access_hda:
#TODO: get_api_value should really go AFTER this - only summary data
return trans.security.encode_dict_ids( hda_dict )
if trans.user_is_admin() or trans.app.config.expose_dataset_path:
@@ -353,6 +356,7 @@ class UsesHistoryDatasetAssociationMixin:
history_id = trans.security.encode_id( history.id ),
history_content_id = trans.security.encode_id( hda.id ) )
# indeces, assoc. metadata files, etc.
meta_files = []
for meta_type in hda.metadata.spec.keys():
if isinstance( hda.metadata.spec[ meta_type ].param, FileParameter ):
@@ -361,13 +365,15 @@ class UsesHistoryDatasetAssociationMixin:
hda_dict[ 'meta_files' ] = meta_files
hda_dict[ 'display_types' ] = self.get_old_display_applications( trans, hda )
#hda_dict[ 'display_apps' ] = self.get_display_apps( trans, hda )
hda_dict[ 'display_apps' ] = self.get_display_apps( trans, hda )
hda_dict[ 'visualizations' ] = hda.get_visualizations()
# return here if deleted
# ---- return here if deleted
if hda.deleted and not purged:
return trans.security.encode_dict_ids( hda_dict )
# if a tool declares 'force_history_refresh' in its xml, when the hda -> ready, reload the history panel
# expensive
if( ( hda.state in [ 'running', 'queued' ] )
and ( hda.creating_job and hda.creating_job.tool_id ) ):
tool_used = trans.app.toolbox.get_tool( hda.creating_job.tool_id )
@@ -383,7 +389,6 @@ class UsesHistoryDatasetAssociationMixin:
def get_display_app_url( display_app_link, hda, trans ):
web_url_for = routes.URLGenerator( trans.webapp.mapper, trans.environ )
dataset_hash, user_hash = da_util.encode_dataset_user( trans, hda, None )
return ''
return web_url_for( controller='dataset',
action="display_application",
dataset_id=dataset_hash,