Skip to content

Commit

Permalink
Merge pull request #2473 from martenson/port-value-to-display
Browse files Browse the repository at this point in the history
[16.04] Avoid empty strings when converting values to display text
  • Loading branch information
nsoranzo committed Jun 8, 2016
2 parents befe354 + 4cd2af8 commit 04863c8
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions lib/galaxy/tools/parameters/basic.py
Expand Up @@ -171,7 +171,9 @@ def value_to_display_text( self, value, app ):
Convert a value to a text representation suitable for displaying to
the user
"""
return unicodify( value )
if value:
return unicodify( value )
return "Not available."

def to_param_dict_string( self, value, other_values={} ):
"""Called via __str__ when used in the Cheetah template"""
Expand Down Expand Up @@ -986,7 +988,9 @@ def value_to_display_text( self, value, app ):
for t, v, s in options:
if v in value:
rval.append( t )
return "\n".join( rval )
if rval:
return "\n".join( rval )
return "Nothing selected."

def get_dependencies( self ):
"""
Expand Down Expand Up @@ -1583,7 +1587,9 @@ def get_option_display( value, options ):
rval = []
for val in value:
rval.append( get_option_display( val, self.options ) or val )
return "\n".join( map( str, rval ) )
if rval:
return "\n".join( map( str, rval ) )
return "Nothing selected."

def get_dependencies( self ):
"""
Expand Down Expand Up @@ -1954,7 +1960,7 @@ def value_to_display_text( self, value, app ):
return ", ".join( [ "%s: %s" % ( item.hid, item.name ) for item in value ] )
except:
pass
return "No dataset"
return "No dataset."

def validate( self, value, trans=None ):
dataset_count = 0
Expand Down

0 comments on commit 04863c8

Please sign in to comment.