[gsoc-admin] append_csv: Split csv data instead of use StringIO
- From: Lasse Schuirmann <lschuirma src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gsoc-admin] append_csv: Split csv data instead of use StringIO
- Date: Wed, 12 Aug 2015 17:51:36 +0000 (UTC)
commit 05256d39374fa8147ef1a55f977f4ad3727ecd0e
Author: Lasse Schuirmann <lasse schuirmann gmail com>
Date: Wed Aug 12 18:46:15 2015 +0200
append_csv: Split csv data instead of use StringIO
The csv library uses the argument as an iterable so this is much easier.
maillib/config.py | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)
---
diff --git a/maillib/config.py b/maillib/config.py
index e68725a..c8d353f 100644
--- a/maillib/config.py
+++ b/maillib/config.py
@@ -96,10 +96,7 @@ class EventConfig:
def append_csv_from_section(self, section):
csv_data = get_main_data_from_section(section)
- ioobj = StringIO()
- ioobj.write(csv_data)
- ioobj.seek(0)
- reader = csv.DictReader(ioobj,
+ reader = csv.DictReader(csv_data.split('\n'),
delimiter=section.get('delimiter', ','))
self.csvs[section.name] = list(reader)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]