Codebase list ctdconverter / 161d2ca
[fix] suggestion to fix #21 Before, if no _supported file formats_ were given, the format given in the CTD was ignored, leaving the format attribute as ```format=""```. Now, mappings will be considered, but if not available, the format from the CTD will be considered. walzer 6 years ago
1 changed file(s) with 7 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
10071007 # assume it's just text unless restrictions are provided
10081008 param_format = "text"
10091009 if param.restrictions is not None:
1010 # join all supported_formats for the file... this MUST be a _FileFormat
1011 if type(param.restrictions) is _FileFormat:
1012 param_format = ','.join(get_supported_file_types(param.restrictions.formats, supported_file_formats))
1010 # join all formats of the file, take mapping from supported_file if available for an entry
1011 if type(param.restrictions) is _FileFormat:
1012 param_format = ','.join([get_supported_file_types(i, supported_file_formats) if
1013 get_supported_file_types(i, supported_file_formats)
1014 else i for i in param.restrictions.formats])
10131015 else:
10141016 raise InvalidModelException("Expected 'file type' restrictions for input file [%(name)s], "
10151017 "but instead got [%(type)s]"
10161018 % {"name": param.name, "type": type(param.restrictions)})
1019
10171020 param_node.attrib["type"] = "data"
1018 param_node.attrib["format"] = param_format
1021 param_node.attrib["format"] = param_format
10191022 # in the case of multiple input set multiple flag
10201023 if param.is_list:
10211024 param_node.attrib["multiple"] = "true"