Merge pull request #14440 from qiagu/dynamic_options

[22.01] Revert startswith of tool parameter options
This commit is contained in:
Marius van den Beek
2022-08-18 19:21:23 +02:00
committed by GitHub
3 changed files with 8 additions and 4 deletions
+1 -1
View File
@@ -4121,7 +4121,7 @@ used to generate dynamic options.
</xs:attribute>
<xs:attribute name="startswith" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="en">Ignore lines starting with the given string.</xs:documentation>
<xs:documentation xml:lang="en">Keep only lines starting with the given string.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="meta_file_key" type="xs:string">
@@ -645,7 +645,7 @@ class DynamicOptions:
rval = []
field_count = None
for line in reader:
if line.startswith("#") or (self.line_startswith and line.startswith(self.line_startswith)):
if line.startswith("#") or (self.line_startswith and not line.startswith(self.line_startswith)):
continue
line = line.rstrip("\n\r")
if line:
@@ -6,7 +6,7 @@ echo select_single '$select_single' > '$output'
<inputs>
<param name="single" type="data" format="csv" label="single"/>
<param name="select_single" type="select" label="select_single">
<options from_dataset="single" separator="," startswith="Transaction_date">
<options from_dataset="single" separator="," startswith="1/3/09">
<column name="name" index="1"/>
<column name="value" index="2"/>
<validator type="no_options" message="No data is available in single" />
@@ -29,11 +29,15 @@ echo select_single '$select_single' > '$output'
</assert_contents>
</output>
</test>
<!-- test that data from "comment" lines can not be selected, i.e. if the startswith attribute of <options> works-->
<!-- test that only data from lines starting with "1/2/09" can be selected, i.e. if the startswith attribute of <options> works-->
<test expect_failure="true">
<param name="single" value="1.csv" />
<param name="select_single" value="Product" />
</test>
<test expect_failure="true">
<param name="single" value="1.csv" />
<param name="select_single" value="Product2" />
</test>
</tests>
<help>
</help>