Skip to content

Commit

Permalink
Merge branch 'release_18.05' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
nsoranzo committed May 11, 2018
2 parents 02e8cb6 + f1eaaea commit c9c7455
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions lib/galaxy/tools/parameters/dynamic_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def __init__(self, d_option, elem):
Filter.__init__(self, d_option, elem)
self.separator = elem.get("separator", ",")
columns = elem.get("column", None)
assert columns is not None, "Required 'columns' attribute missing from filter"
assert columns is not None, "Required 'column' attribute missing from filter"
self.columns = [d_option.column_spec_to_index(column) for column in columns.split(",")]

def filter_options(self, options, trans, other_values):
Expand Down Expand Up @@ -305,9 +305,9 @@ def __init__(self, d_option, elem):
Filter.__init__(self, d_option, elem)
self.pair_separator = elem.get("pair_separator", ",")
self.name_val_separator = elem.get("name_val_separator", None)
self.columns = elem.get("column", None)
assert self.columns is not None, "Required 'columns' attribute missing from filter"
self.columns = [int(column) for column in self.columns.split(",")]
columns = elem.get("column", None)
assert columns is not None, "Required 'column' attribute missing from filter"
self.columns = [d_option.column_spec_to_index(column) for column in columns.split(",")]

def filter_options(self, options, trans, other_values):
attr_names = []
Expand Down Expand Up @@ -509,7 +509,8 @@ def load_from_parameter(from_parameter, transform_lines=None):
full_path = os.path.join(self.tool_param.tool.app.config.tool_data_path, data_file)
if os.path.exists(full_path):
self.index_file = data_file
self.file_fields = self.parse_file_fields(open(full_path))
with open(full_path) as fh:
self.file_fields = self.parse_file_fields(fh)
else:
self.missing_index_file = data_file
elif dataset_file is not None:
Expand Down Expand Up @@ -622,8 +623,10 @@ def get_fields(self, trans, other_values):
options = self.parse_file_fields(StringIO(contents))
elif self.tool_data_table:
options = self.tool_data_table.get_fields()
else:
elif self.file_fields:
options = list(self.file_fields)
else:
options = []
for filter in self.filters:
options = filter.filter_options(options, trans, other_values)
return options
Expand Down Expand Up @@ -658,7 +661,7 @@ def get_field_by_name_for_value(self, field_name, value, trans, other_values):

def get_options(self, trans, other_values):
rval = []
if self.file_fields is not None or self.tool_data_table is not None or self.dataset_ref_name is not None:
if self.file_fields is not None or self.tool_data_table is not None or self.dataset_ref_name is not None or self.missing_index_file:
options = self.get_fields(trans, other_values)
for fields in options:
rval.append((fields[self.columns['name']], fields[self.columns['value']], False))
Expand Down

0 comments on commit c9c7455

Please sign in to comment.