mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-11 09:28:27 -04:00
Merge pull request #1911 from alphagov/fix-date-exception
Catch exceptions caused by ambiguous Excel files
This commit is contained in:
@@ -22,6 +22,7 @@ from notifications_utils.recipients import (
|
||||
from orderedset import OrderedSet
|
||||
from werkzeug.routing import RequestRedirect
|
||||
from xlrd.biffh import XLRDError
|
||||
from xlrd.xldate import XLDateError
|
||||
|
||||
from app import (
|
||||
current_service,
|
||||
@@ -137,6 +138,13 @@ def send_messages(service_id, template_id):
|
||||
flash('Couldn’t read {}. Try using a different file format.'.format(
|
||||
form.file.data.filename
|
||||
))
|
||||
except (XLDateError):
|
||||
flash((
|
||||
'{} contains numbers or dates that Notify can’t understand. '
|
||||
'Try formatting all columns as ‘text’ or export your file as CSV.'
|
||||
).format(
|
||||
form.file.data.filename
|
||||
))
|
||||
|
||||
column_headings = first_column_headings[template.template_type] + list(template.placeholders)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user