From 4cd2af860ffc31ee574e6f81c941840ae603efe5 Mon Sep 17 00:00:00 2001 From: guerler Date: Fri, 20 May 2016 13:18:01 -0400 Subject: [PATCH] Avoid empty strings when converting values to display text --- lib/galaxy/tools/parameters/basic.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/galaxy/tools/parameters/basic.py b/lib/galaxy/tools/parameters/basic.py index 9ab8a1d2ac69..1dd938212c12 100644 --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -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""" @@ -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 ): """ @@ -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 ): """ @@ -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