summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY.rst15
-rw-r--r--setup.py2
-rw-r--r--tablib/core.py30
3 files changed, 34 insertions, 13 deletions
diff --git a/HISTORY.rst b/HISTORY.rst
index c113ff5..ca0470f 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -1,11 +1,20 @@
History
=======
-0.6.4 (2010-09-13)
+0.7.0 (2010-09-20)
------------------
-* Updated unicode export for XLS
-* More exhaustive unit tests
+* Renamed DataBook Databook for consistiency.
+* Export properties changed to methods (XLS filename / StringIO bug).
+* Optional Dataset.xls(path='filename') support (for writing on windows).
+* Added utf-8 on the worksheet level.
+
+
+0.6.4 (2010-09-19)
+------------------
+
+* Updated unicode export for XLS.
+* More exhaustive unit tests.
0.6.3 (2010-09-14)
diff --git a/setup.py b/setup.py
index f9b71ea..c853439 100644
--- a/setup.py
+++ b/setup.py
@@ -18,7 +18,7 @@ if sys.argv[-1] == "publish":
setup(
name='tablib',
- version='0.6.4',
+ version='0.7.0',
description='Format agnostic tabular data library (XLS, JSON, YAML, CSV)',
long_description=open('README.rst').read() + '\n\n' +
open('HISTORY.rst').read(),
diff --git a/tablib/core.py b/tablib/core.py
index a86c4ea..f300be6 100644
--- a/tablib/core.py
+++ b/tablib/core.py
@@ -21,8 +21,8 @@ from helpers import *
# __all__ = ['Dataset', 'DataBook']
__name__ = 'tablib'
-__version__ = '0.6.4'
-__build__ = 0x000604
+__version__ = '0.7.0'
+__build__ = 0x000700
__author__ = 'Kenneth Reitz'
__license__ = 'MIT'
__copyright__ = 'Copyright 2010 Kenneth Reitz'
@@ -178,16 +178,21 @@ class Dataset(object):
def xls(self, path=None):
"""Returns XLS representation of Dataset."""
- stream = StringIO.StringIO()
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)
- wb.save(stream)
- return stream.getvalue()
+ if path:
+ wb.save(path)
+ return True
+ else:
+ stream = StringIO.StringIO()
+ wb.save(stream)
+ return stream.getvalue()
def append(self, row=None, col=None):
@@ -222,7 +227,7 @@ class Dataset(object):
pass
-class DataBook(object):
+class Databook(object):
"""A book of Dataset objects.
Currently, this exists only for XLS workbook support.
"""
@@ -265,7 +270,7 @@ class DataBook(object):
def xls(self, path=None):
"""Returns XLS representation of DataBook."""
- stream = cStringIO.StringIO()
+
wb = xlwt.Workbook(encoding='utf8')
for i, dset in enumerate(self._datasets):
@@ -276,8 +281,15 @@ class DataBook(object):
for j, col in enumerate(row):
ws.write(i, j, col)
- wb.save(stream)
- return stream.getvalue()
+
+
+ if path:
+ wb.save(path)
+ return True
+ else:
+ stream = cStringIO.StringIO()
+ wb.save(stream)
+ return stream.getvalue()
def json(self):