Commit 2f409dd6 authored by Pierre Dittgen's avatar Pierre Dittgen

Better duplicate-row message

parent 98a2f2df
......@@ -90,9 +90,18 @@ def improve_messages(errors):
for error in errors:
if error['code'] == 'blank-row':
update_message(error, 'la ligne {} est vide'.format(error['row-number']))
update_message(error, 'la ligne est vide')
elif error['code'] == 'duplicate-row':
update_message(error, 'la ligne {} est identique à la précédente'.format(error['row-number']))
msg_prefix = 'la ligne est identique '
row_numbers = error['message-data']['row_numbers']
if len(row_numbers) == 1:
msg = msg_prefix + "à la ligne {}".format(row_numbers)
else:
idx = row_numbers.rfind(',')
param_str = row_numbers[:idx] + ' et' + row_numbers[idx+1:]
msg = msg_prefix + "aux lignes {}".format(param_str)
update_message(error, msg)
# Return updated error list
return errors
......
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