Merge pull request #67 from dannon/expressionfix

[STABLE] Fixes for using expression contexts in select parameters.
This commit is contained in:
John Chilton
2015-04-02 07:44:07 -05:00
+5 -2
View File
@@ -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
@@ -1505,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 )