Merge pull request #24 from mwalzer/feature/issue21
[fix] suggestion to fix #21
chahuistle authored 6 years ago
GitHub committed 6 years ago
1001 | 1001 | # assume it's just text unless restrictions are provided |
1002 | 1002 | param_format = "text" |
1003 | 1003 | if param.restrictions is not None: |
1004 | # join all supported_formats for the file... this MUST be a _FileFormat | |
1005 | if type(param.restrictions) is _FileFormat: | |
1006 | param_format = ','.join(get_supported_file_types(param.restrictions.formats, supported_file_formats)) | |
1004 | # join all formats of the file, take mapping from supported_file if available for an entry | |
1005 | if type(param.restrictions) is _FileFormat: | |
1006 | param_format = ','.join([get_supported_file_types(i, supported_file_formats) if | |
1007 | get_supported_file_types(i, supported_file_formats) | |
1008 | else i for i in param.restrictions.formats]) | |
1007 | 1009 | else: |
1008 | 1010 | raise InvalidModelException("Expected 'file type' restrictions for input file [%(name)s], " |
1009 | 1011 | "but instead got [%(type)s]" |
1010 | 1012 | % {"name": param.name, "type": type(param.restrictions)}) |
1013 | ||
1011 | 1014 | param_node.attrib["type"] = "data" |
1012 | param_node.attrib["format"] = param_format | |
1015 | param_node.attrib["format"] = param_format | |
1013 | 1016 | # in the case of multiple input set multiple flag |
1014 | 1017 | if param.is_list: |
1015 | 1018 | param_node.attrib["multiple"] = "true" |