Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[22.01] Revert startswith of tool parameter options #14440

Merged
merged 3 commits into from
Aug 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/galaxy/tool_util/xsd/galaxy.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/tools/parameters/dynamic_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ def parse_file_fields(self, reader):
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:
Expand Down
8 changes: 6 additions & 2 deletions test/functional/tools/select_from_csvdataset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand All @@ -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>
Expand Down