Merge pull request #946 from normanjaeckel/FixImport
Fix #934: Error in motion import with bad csv file.
This commit is contained in:
commit
7fcc786cf9
@ -46,7 +46,7 @@ def import_motions(csv_file, default_submitter, override=False, importing_person
|
|||||||
try:
|
try:
|
||||||
csv_file.read().decode('utf8')
|
csv_file.read().decode('utf8')
|
||||||
except UnicodeDecodeError:
|
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)
|
csv_file.seek(0)
|
||||||
|
|
||||||
with transaction.commit_on_success():
|
with transaction.commit_on_success():
|
||||||
|
@ -93,6 +93,9 @@ class CSVImport(TestCase):
|
|||||||
text = u'Müller'.encode('iso-8859-15')
|
text = u'Müller'.encode('iso-8859-15')
|
||||||
csv_file.write(text)
|
csv_file.write(text)
|
||||||
csv_file.seek(0)
|
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_success, 0)
|
||||||
|
self.assertEqual(count_lines, 0)
|
||||||
self.assertTrue('Import file has wrong character encoding, only UTF-8 is supported!' in error_messages)
|
self.assertTrue('Import file has wrong character encoding, only UTF-8 is supported!' in error_messages)
|
||||||
|
Loading…
Reference in New Issue
Block a user