Skip to content

Commit

Permalink
Allow #if $datasets #end if patern for file lists
Browse files Browse the repository at this point in the history
Otherwise the following exception occurs:
```
Traceback (most recent call last):
  File "/home/wolffj/src/galaxy/lib/galaxy/jobs/runners/__init__.py", line 191, in prepare_job
    job_wrapper.prepare()
  File "/home/wolffj/src/galaxy/lib/galaxy/jobs/__init__.py", line 858, in prepare
    self.command_line, self.extra_filenames, self.environment_variables = tool_evaluator.build()
  File "/home/wolffj/src/galaxy/lib/galaxy/tools/evaluation.py", line 435, in build
    raise e
AttributeError: 'DatasetListWrapper' object has no attribute 'value'
```

This is because DatasetListWrapper inherits `__bool__` from ToolParameterValueWrapper
which defines bool as
```
    def __bool__(self):
        return bool(self.value)
    __nonzero__ = __bool__
```
while DatasetListWrapper has no `value` attribute.

Fixes #6314 reported by
@joachimwolff (many thanks for the detailed report!).
  • Loading branch information
mvdbeek committed Jun 12, 2018
1 parent 9a79839 commit 713bca0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/galaxy/tools/wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,11 @@ def to_dataset_instances(dataset_instance_sources):
def __str__(self):
return ','.join(map(str, self))

def __bool__(self):
# Fail `#if $param` checks in cheetah if optional input is not provided
return len(self) > 0
__nonzero__ = __bool__


class DatasetCollectionWrapper(ToolParameterValueWrapper, HasDatasets):

Expand Down

0 comments on commit 713bca0

Please sign in to comment.