Make format extension optional

The format extension defaults to the name of the format if it is not
provided.
This commit is contained in:
Jack Wilsdon 2016-04-29 14:51:13 +01:00
parent 2ebb8ee025
commit ae9ece1e62

View file

@ -60,10 +60,10 @@ def get_format(fmt=None):
try:
format_info = config['convert']['formats'][fmt].get(dict)
command = format_info['command']
extension = format_info['extension']
extension = format_info.get('extension', fmt)
except KeyError:
raise ui.UserError(
u'convert: format {0} needs "command" and "extension" fields'
u'convert: format {0} needs the "command" field'
.format(fmt)
)
except ConfigTypeError: