From 6175ce25c5b424a22ff5b1b4e6f6212d04053d16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Tue, 22 Oct 2013 00:17:56 +0200 Subject: [PATCH] Fix #934: Error in motion import with bad csv file. --- openslides/motion/csv_import.py | 2 +- tests/motion/test_csv_import.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/openslides/motion/csv_import.py b/openslides/motion/csv_import.py index 694990ad7..14ee309a5 100644 --- a/openslides/motion/csv_import.py +++ b/openslides/motion/csv_import.py @@ -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(): diff --git a/tests/motion/test_csv_import.py b/tests/motion/test_csv_import.py index 3966a00c1..0d2883c6d 100644 --- a/tests/motion/test_csv_import.py +++ b/tests/motion/test_csv_import.py @@ -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)