Parameter sanitizer can now be turned off by individual tools. Refresh behavior after tool execution can now be defined in

the tool xml file.

To Do: Allow individual parameters to have sanitation control.
This commit is contained in:
Daniel Blankenberg
2007-02-21 18:01:07 +00:00
parent 9903924f97
commit 573e8cd8a2
6 changed files with 19 additions and 9 deletions
+1 -1
View File
@@ -35,7 +35,7 @@ class ToolRunner(common.Root):
log.error( "index called with tool id '%s' but no such tool exists", tool_id )
trans.log_event( "Tool id '%s' does not exist" % tool_id )
return "Tool '%s' does not exist, kwd=%s " % (tool_id, kwd)
params = util.Params(kwd)
params = util.Params(kwd, sanitize = tool.options.sanitize)
history = trans.get_history()
trans.ensure_valid_galaxy_session()
template, vars = tool.handle_input( trans, params.__dict__ )
+9
View File
@@ -132,6 +132,15 @@ class Tool:
file_name = code_elem.get("file")
code_path = os.path.join( self.tool_dir, file_name )
execfile( code_path, self.code_namespace )
# Load any tool specific options (optional)
self.options = {'sanitize':True, 'refresh':False}
for option_elem in root.findall("options"):
for option, value in self.options.copy().items():
if isinstance(value, type(False)):
self.options[option] = util.string_as_bool(option_elem.get(option, str(value)))
else:
self.options[option] = option_elem.get(option, str(value))
self.options = Bunch(** self.options)
# Load parameters (optional)
input_elem = root.find("inputs")
if input_elem:
+2 -2
View File
@@ -157,10 +157,10 @@ class Params:
# different parameters can be sanitized in different ways.
NEVER_SANITIZE = ['file_data', 'url_paste', 'URL']
def __init__(self, params, safe=True):
def __init__(self, params, safe=True, sanitize=True):
if safe:
for key, value in params.items():
if key not in self.NEVER_SANITIZE:
if key not in self.NEVER_SANITIZE and sanitize:
self.__dict__[key] = sanitize_param(value)
else:
self.__dict__[key] = value
+3 -6
View File
@@ -1,6 +1,3 @@
#set $refresh = $tool.id in [ 'biomart', 'encode_db1' ]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
@@ -16,14 +13,14 @@ if ( parent.frames && parent.frames.galaxy_history )
function add_refresh()
{
#if $refresh
#if $tool.options.refresh
setTimeout( "refresh()", 1000 ); //
#end if
}
function refresh()
{
window.location.href = '$request.base';
top.location.href = '$request.base';
}
</script>
@@ -36,7 +33,7 @@ if ( parent.frames && parent.frames.galaxy_history )
<div class="donemessage">
#if $refresh
#if $tool.options.refresh
<h3 align="center">Redirecting to <a href="$request.base">GALAXY</a> </h3>
#end if
+2
View File
@@ -15,6 +15,8 @@
<outputs>
<data name="output" format="text" />
</outputs>
<options sanitize="False" refresh="True"/>
</tool>
+2
View File
@@ -17,5 +17,7 @@
</inputs>
<code file="encodedb_filter.py"/>
<options sanitize="False" refresh="True"/>
</tool>