From 6e5cd74a3115bee90e63d9b0ade879e6eee20049 Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Thu, 2 Apr 2015 08:13:33 -0400 Subject: [PATCH 1/2] Fix dynamic options not filling properly --- lib/galaxy/tools/parameters/basic.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/galaxy/tools/parameters/basic.py b/lib/galaxy/tools/parameters/basic.py index b3ecac09217..60993d926aa 100644 --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -15,6 +15,7 @@ from galaxy.util.bunch import Bunch from galaxy.util import string_as_bool, sanitize_param, unicodify from galaxy.util import listify from galaxy.util.odict import odict +from galaxy.util.expressions import ExpressionContext from sanitize import ToolParameterSanitizer import validation import dynamic_options @@ -802,8 +803,9 @@ class SelectToolParameter( ToolParameter ): self.is_dynamic = ( ( self.dynamic_options is not None ) or ( self.options is not None ) ) def _get_dynamic_options_call_other_values( self, trans, other_values ): - call_other_values = { "__trans__": trans } + call_other_values = ExpressionContext({ "__trans__": trans }) if other_values: + call_other_values.parent = other_values.parent call_other_values.update( other_values.dict ) return call_other_values From 8bbd24007cbea603eb9c20660c87e2d9a919015e Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Thu, 2 Apr 2015 08:15:43 -0400 Subject: [PATCH 2/2] Fix get_options_from_code to correctly use an expresioncontext as well, this would have prevented it working in repeats/etc --- lib/galaxy/tools/parameters/basic.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/galaxy/tools/parameters/basic.py b/lib/galaxy/tools/parameters/basic.py index 60993d926aa..744bff0932b 100644 --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -1507,8 +1507,9 @@ class DrillDownSelectToolParameter( SelectToolParameter ): def _get_options_from_code( self, trans=None, value=None, other_values=None ): assert self.dynamic_options, Exception( "dynamic_options was not specifed" ) - call_other_values = { '__trans__': trans, '__value__': value } + call_other_values = ExpressionContext({ '__trans__': trans, '__value__': value }) if other_values: + call_other_values.parent = other_values.parent call_other_values.update( other_values.dict ) try: return eval( self.dynamic_options, self.tool.code_namespace, call_other_values )