Fix #934: Error in motion import with bad csv file.
This commit is contained in:
parent
b0b91e94c0
commit
6175ce25c5
@ -46,7 +46,7 @@ def import_motions(csv_file, default_submitter, override=False, importing_person
|
||||
try:
|
||||
csv_file.read().decode('utf8')
|
||||
except UnicodeDecodeError:
|
||||
return (0, [_('Import file has wrong character encoding, only UTF-8 is supported!')], [])
|
||||
return (0, 0, [_('Import file has wrong character encoding, only UTF-8 is supported!')], [])
|
||||
csv_file.seek(0)
|
||||
|
||||
with transaction.commit_on_success():
|
||||
|
@ -93,6 +93,9 @@ class CSVImport(TestCase):
|
||||
text = u'Müller'.encode('iso-8859-15')
|
||||
csv_file.write(text)
|
||||
csv_file.seek(0)
|
||||
count_success, error_messages, warning_messages = import_motions(csv_file=csv_file, default_submitter=self.normal_user.person_id)
|
||||
count_success, count_lines, error_messages, warning_messages = import_motions(
|
||||
csv_file=csv_file,
|
||||
default_submitter=self.normal_user.person_id)
|
||||
self.assertEqual(count_success, 0)
|
||||
self.assertEqual(count_lines, 0)
|
||||
self.assertTrue('Import file has wrong character encoding, only UTF-8 is supported!' in error_messages)
|
||||
|
Loading…
Reference in New Issue
Block a user