Commit ccfc5d32 authored by Pierre Dittgen's avatar Pierre Dittgen
Browse files

Fixes boolean format error value

parent 5746d6f3
......@@ -139,7 +139,7 @@ def required_constraint(err, schema):
def type_or_format_error(err, schema):
"""type-or-format-value"""
"""type-or-format-error"""
err_type = err['message-data']['field_type']
err_value = err['message-data']['value']
......@@ -182,11 +182,14 @@ def type_or_format_error(err, schema):
# Boolean
elif err_type == 'boolean':
column_number = err['column-number']
column_number = err['column-number'] - 1
field = schema['fields'][column_number]
true_values = field.get('trueValues', ['true'])
false_values = field.get('falseValues', ['false'])
return u_err(err, "Valeur booléenne incorrecte", "Les valeurs acceptées sont {} pour 'vrai' et {} pour 'faux'".format(et_join(false_values), et_join(true_values)))
true_values_str = et_join(list(map(lambda v: '`{}`'.format(v), true_values)))
false_values_str = et_join(list(map(lambda v: '`{}`'.format(v), false_values)))
return u_err(err, "Valeur booléenne incorrecte",
"Les valeurs acceptées sont {} (vrai) et {} (faux)".format(true_values_str, false_values_str))
# Default msg
return u_err(err, 'Type ou format incorrect', 'La valeur de la cellule n\'est pas de type {}'.format(err_type))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment