diff options
| author | Kenneth Reitz <me@kennethreitz.com> | 2010-09-20 12:50:10 -0400 |
|---|---|---|
| committer | Kenneth Reitz <me@kennethreitz.com> | 2010-09-20 12:50:10 -0400 |
| commit | bfbb7c626ff70b9d840648cee546d4d2fad349a3 (patch) | |
| tree | ed1cc97bec5d84532a8425547678e7ef0614d453 /tablib | |
| parent | be0f77f9ee108909a9d268ae50089ad367216946 (diff) | |
| download | tablib-bfbb7c626ff70b9d840648cee546d4d2fad349a3.tar.gz | |
Moved from cStringIO to StringIO. More stable.
Diffstat (limited to 'tablib')
| -rw-r--r-- | tablib/core.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tablib/core.py b/tablib/core.py index e97b8a6..9e0c4e3 100644 --- a/tablib/core.py +++ b/tablib/core.py @@ -8,7 +8,7 @@ import csv -import cStringIO +import StringIO import random import simplejson as json @@ -171,7 +171,7 @@ class Dataset(object): @property def csv(self): """Returns CSV representation of Dataset.""" - stream = cStringIO.StringIO() + stream = StringIO.StringIO() _csv = csv.writer(stream) for row in self._package(dicts=False): @@ -183,13 +183,13 @@ class Dataset(object): @property def xls(self): """Returns XLS representation of Dataset.""" - stream = cStringIO.StringIO() + stream = StringIO.StringIO() - wb = xlwt.Workbook() + wb = xlwt.Workbook(encoding='utf8') ws = wb.add_sheet(self.title if self.title else 'Tabbed Dataset') for i, row in enumerate(self._package(dicts=False)): for j, col in enumerate(row): - ws.write(i, j, col.decode('utf8')) + ws.write(i, j, col) wb.save(stream) return stream.getvalue() @@ -272,7 +272,7 @@ class DataBook(object): """Returns XLS representation of DataBook.""" stream = cStringIO.StringIO() - wb = xlwt.Workbook() + wb = xlwt.Workbook(encoding='utf8') for i, dset in enumerate(self._datasets): ws = wb.add_sheet(dset.title if dset.title else 'Sheet%s' % (i)) @@ -280,7 +280,7 @@ class DataBook(object): #for row in self._package(dicts=False): for i, row in enumerate(dset._package(dicts=False)): for j, col in enumerate(row): - ws.write(i, j, str(col)) + ws.write(i, j, col) wb.save(stream) return stream.getvalue() |
