Merge branch 'release_15.03' into dev

This commit is contained in:
Nate Coraor
2015-04-22 14:31:45 -04:00
2 changed files with 12 additions and 10 deletions
+11 -9
View File
@@ -417,13 +417,14 @@ class Tool( object, Dictifiable ):
dict_collection_visible_keys = ( 'id', 'name', 'version', 'description' )
default_template = 'tool_form.mako'
def __init__( self, config_file, tool_source, app, guid=None, repository_id=None ):
def __init__( self, config_file, tool_source, app, guid=None, repository_id=None, allow_code_files=True ):
"""Load a tool from the config named by `config_file`"""
# Determine the full path of the directory where the tool config is
self.config_file = config_file
self.tool_dir = os.path.dirname( config_file )
self.app = app
self.repository_id = repository_id
self._allow_code_files = allow_code_files
#setup initial attribute values
self.inputs = odict()
self.stdio_exit_codes = list()
@@ -704,14 +705,15 @@ class Tool( object, Dictifiable ):
# Load any tool specific code (optional) Edit: INS 5/29/2007,
# allow code files to have access to the individual tool's
# "module" if it has one. Allows us to reuse code files, etc.
for code_elem in root.findall("code"):
for hook_elem in code_elem.findall("hook"):
for key, value in hook_elem.items():
# map hook to function
self.hook_map[key] = value
file_name = code_elem.get("file")
code_path = os.path.join( self.tool_dir, file_name )
execfile( code_path, self.code_namespace )
if self._allow_code_files:
for code_elem in root.findall("code"):
for hook_elem in code_elem.findall("hook"):
for key, value in hook_elem.items():
# map hook to function
self.hook_map[key] = value
file_name = code_elem.get("file")
code_path = os.path.join( self.tool_dir, file_name )
execfile( code_path, self.code_namespace )
# User interface hints
uihints_elem = root.find( "uihints" )
+1 -1
View File
@@ -292,7 +292,7 @@ class ToolValidator( object ):
def load_tool_from_config( self, repository_id, full_path ):
try:
tool = self.app.toolbox.load_tool( full_path, repository_id=repository_id )
tool = self.app.toolbox.load_tool( full_path, repository_id=repository_id, allow_code_files=False )
valid = True
error_message = None
except KeyError, e: