From ea15f398e79771b6dd6ba5fdf0c8d96e10d39734 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Wed, 2 Aug 2017 19:58:37 +0200 Subject: [PATCH] Fix failing API tests for explicit collection outputs --- lib/galaxy/tools/execute.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/lib/galaxy/tools/execute.py b/lib/galaxy/tools/execute.py index 578cffe930f..0751555133e 100644 --- a/lib/galaxy/tools/execute.py +++ b/lib/galaxy/tools/execute.py @@ -158,16 +158,19 @@ class ToolExecutionTracker( object ): continue output = self.tool.outputs[ output_name ] - # Switch the structure for outputs if the output specified a default_identifier_source - collection_type_descriptions = trans.app.dataset_collections_service.collection_type_descriptions - _structure = None - source_collection = self.collection_info.collections.get(output.default_identifier_source) - if source_collection: - collection_type_description = collection_type_descriptions.for_collection_type(source_collection.collection.collection_type) - _structure = structure.for_dataset_collection( source_collection.collection, collection_type_description=collection_type_description) - if _structure and structure.can_match(_structure): - element_identifiers = _structure.element_identifiers_for_outputs(trans, outputs) - else: + element_identifiers = None + if hasattr(output, "default_identifier_source"): + # Switch the structure for outputs if the output specified a default_identifier_source + collection_type_descriptions = trans.app.dataset_collections_service.collection_type_descriptions + + source_collection = self.collection_info.collections.get(output.default_identifier_source) + if source_collection: + collection_type_description = collection_type_descriptions.for_collection_type(source_collection.collection.collection_type) + _structure = structure.for_dataset_collection( source_collection.collection, collection_type_description=collection_type_description) + if structure.can_match(_structure): + element_identifiers = _structure.element_identifiers_for_outputs(trans, outputs) + + if not element_identifiers: element_identifiers = structure.element_identifiers_for_outputs( trans, outputs ) implicit_collection_info = dict(