mirror of
https://github.com/kennethreitz/tablib.git
synced 2026-06-05 23:10:17 +00:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3c66697280 | |||
| 13334b7996 | |||
| 77a5c8d3fb | |||
| 79d66cd250 | |||
| 77469ef655 | |||
| e21676d3bd | |||
| 7c59e1ae86 | |||
| 2814fbc381 | |||
| 9ca1d4ec54 | |||
| abbb4e32d8 | |||
| 9ba0451843 |
@@ -1,6 +1,11 @@
|
|||||||
History
|
History
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
0.11.3 (2016-02-16)
|
||||||
|
+++++++++++++++++++
|
||||||
|
|
||||||
|
- Release fix.
|
||||||
|
|
||||||
0.11.2 (2016-02-16)
|
0.11.2 (2016-02-16)
|
||||||
+++++++++++++++++++
|
+++++++++++++++++++
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -41,7 +41,7 @@ master_doc = 'index'
|
|||||||
|
|
||||||
# General information about the project.
|
# General information about the project.
|
||||||
project = u'Tablib'
|
project = u'Tablib'
|
||||||
copyright = u'2011. A <a href="http://kennethreitz.com/pages/open-projects.html">Kenneth Reitz</a> Project'
|
copyright = u'2016. A <a href="http://kennethreitz.org/">Kenneth Reitz</a> Project'
|
||||||
|
|
||||||
# The version info for the project you're documenting, acts as replacement for
|
# The version info for the project you're documenting, acts as replacement for
|
||||||
# |version| and |release|, also used in various other places throughout the
|
# |version| and |release|, also used in various other places throughout the
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ Once installed, we can generate our xUnit report with a single command. ::
|
|||||||
|
|
||||||
This will generate a **nosetests.xml** file, which can then be analyzed.
|
This will generate a **nosetests.xml** file, which can then be analyzed.
|
||||||
|
|
||||||
.. _Nose: http://somethingaboutorange.com/mrl/projects/nose/
|
.. _Nose: https://github.com/nose-devs/nose
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -18,8 +18,8 @@ from tablib.compat import OrderedDict, unicode
|
|||||||
|
|
||||||
|
|
||||||
__title__ = 'tablib'
|
__title__ = 'tablib'
|
||||||
__version__ = '0.11.2'
|
__version__ = '0.11.3'
|
||||||
__build__ = 0x001102
|
__build__ = 0x001103
|
||||||
__author__ = 'Kenneth Reitz'
|
__author__ = 'Kenneth Reitz'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright 2016 Kenneth Reitz'
|
__copyright__ = 'Copyright 2016 Kenneth Reitz'
|
||||||
@@ -1105,7 +1105,7 @@ class Databook(object):
|
|||||||
"""The number of the :class:`Dataset` objects within :class:`Databook`."""
|
"""The number of the :class:`Dataset` objects within :class:`Databook`."""
|
||||||
return len(self._datasets)
|
return len(self._datasets)
|
||||||
|
|
||||||
def load(self, format, in_stream, **kwargs):
|
def load(self, in_stream, format, **kwargs):
|
||||||
"""
|
"""
|
||||||
Import `in_stream` to the :class:`Databook` object using the `format`.
|
Import `in_stream` to the :class:`Databook` object using the `format`.
|
||||||
|
|
||||||
|
|||||||
+10
-12
@@ -17,6 +17,7 @@ import tablib
|
|||||||
Workbook = openpyxl.workbook.Workbook
|
Workbook = openpyxl.workbook.Workbook
|
||||||
ExcelWriter = openpyxl.writer.excel.ExcelWriter
|
ExcelWriter = openpyxl.writer.excel.ExcelWriter
|
||||||
get_column_letter = openpyxl.cell.get_column_letter
|
get_column_letter = openpyxl.cell.get_column_letter
|
||||||
|
DataTypeException = openpyxl.shared.exc.DataTypeException
|
||||||
|
|
||||||
from tablib.compat import unicode
|
from tablib.compat import unicode
|
||||||
|
|
||||||
@@ -120,7 +121,6 @@ def dset_sheet(dataset, ws, freeze_panes=True):
|
|||||||
if (row_number == 1) and dataset.headers:
|
if (row_number == 1) and dataset.headers:
|
||||||
# ws.cell('%s%s'%(col_idx, row_number)).value = unicode(
|
# ws.cell('%s%s'%(col_idx, row_number)).value = unicode(
|
||||||
# '%s' % col, errors='ignore')
|
# '%s' % col, errors='ignore')
|
||||||
ws.cell('%s%s'%(col_idx, row_number)).value = unicode(col)
|
|
||||||
style = ws.get_style('%s%s' % (col_idx, row_number))
|
style = ws.get_style('%s%s' % (col_idx, row_number))
|
||||||
style.font.bold = True
|
style.font.bold = True
|
||||||
if freeze_panes:
|
if freeze_panes:
|
||||||
@@ -130,23 +130,21 @@ def dset_sheet(dataset, ws, freeze_panes=True):
|
|||||||
|
|
||||||
# bold separators
|
# bold separators
|
||||||
elif len(row) < dataset.width:
|
elif len(row) < dataset.width:
|
||||||
ws.cell('%s%s'%(col_idx, row_number)).value = unicode(
|
|
||||||
'%s' % col, errors='ignore')
|
|
||||||
style = ws.get_style('%s%s' % (col_idx, row_number))
|
style = ws.get_style('%s%s' % (col_idx, row_number))
|
||||||
style.font.bold = True
|
style.font.bold = True
|
||||||
|
|
||||||
# wrap the rest
|
# wrap the rest
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
if '\n' in col:
|
str_col_value = unicode(col)
|
||||||
ws.cell('%s%s'%(col_idx, row_number)).value = unicode(
|
except TypeError:
|
||||||
'%s' % col, errors='ignore')
|
str_col_value = ''
|
||||||
|
|
||||||
|
if '\n' in str_col_value:
|
||||||
style = ws.get_style('%s%s' % (col_idx, row_number))
|
style = ws.get_style('%s%s' % (col_idx, row_number))
|
||||||
style.alignment.wrap_text
|
style.alignment.wrap_text
|
||||||
else:
|
|
||||||
ws.cell('%s%s'%(col_idx, row_number)).value = unicode(
|
|
||||||
'%s' % col, errors='ignore')
|
|
||||||
except TypeError:
|
|
||||||
ws.cell('%s%s'%(col_idx, row_number)).value = unicode(col)
|
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
ws.cell('%s%s' % (col_idx, row_number)).value = col
|
||||||
|
except (ValueError, TypeError, DataTypeException):
|
||||||
|
ws.cell('%s%s' % (col_idx, row_number)).value = unicode(col)
|
||||||
|
|||||||
Reference in New Issue
Block a user