On Thu, Oct 7, 2010 at 2:25 PM, Peter <peter@maubp.freeserve.co.uk> wrote:
Hello all,
I'm trying to define an optional integer and float parameter, for example I'd like to do this:
<param name="max_hits" type="integer" value="" optional="true" label="Maximum hits to show" help="Use blank (or zero) for default limits"> <validator type="in_range" min="0" /> </param>
However, that insists on having an integer (on pressing execute, this parameter goes red and says "An integer is required"), overriding the optional setting.
The problem isn't coming from the validator, consider this example:
<param name="max_hits" type="integer" value="" optional="true" label="Maximum hits to show" help="Use blank (or zero or negative) for default limits" />
That allows negative values to be entered, but also still insists on a value.
Looking at the code, in lib/galaxy/tools/parameters/basic.py only DataToolParameter currently seems to look at the optional element from the XML.
The following patch makes it explicit that 'optional' is not currently supported on integer and float parameters (I intend to try and fix that next). http://bitbucket.org/peterjc/galaxy-central/changeset/f6a6c998a015
Docstrings, undo accidental commit to a tool XML file, and first attempt at optional integer and float parameters: http://bitbucket.org/peterjc/galaxy-central/changeset/b555f887ee55 http://bitbucket.org/peterjc/galaxy-central/changeset/9ba1f50d3310 http://bitbucket.org/peterjc/galaxy-central/changeset/1c0e5ef7560a All on my branch "stuff". Is there any interest in supporting optional integer and float args? I'd like to have this for the BLAST+ wrappers, but it is not essential. Peter