Skip to content

Commit

Permalink
back port the fix for #24 to 0.2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
chfw committed Dec 21, 2016
1 parent c4a74f4 commit 58e541c
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 15 deletions.
33 changes: 25 additions & 8 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
Change log
================================================================================

0.26 - 21.12.2016
--------------------------------------------------------------------------------

Updated
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

#. `#24 <https://github.com/pyexcel/pyexcel-io/issues/24>`__, pass on batch_size


0.25 - 20.12.2016
--------------------------------------------------------------------------------

Expand All @@ -25,17 +34,19 @@ Updated
Added
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

#. `#21 <https://github.com/pyexcel/pyexcel-io/issues/21>`__, choose subset from data base tables for export
#. `#22 <https://github.com/pyexcel/pyexcel-io/issues/22>`__, custom renderer if given `row_renderer` as parameter.
#. `#21 <https://github.com/pyexcel/pyexcel-io/issues/21>`__, choose subset from
data base tables for export
#. `#22 <https://github.com/pyexcel/pyexcel-io/issues/22>`__, custom renderer if
given `row_renderer` as parameter.

0.22 - 31.08.2016
--------------------------------------------------------------------------------

Added
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

#. support pagination. two pairs: start_row, row_limit and start_column, column_limit
help you deal with large files.
#. support pagination. two pairs: start_row, row_limit and start_column,
column_limit help you deal with large files.
#. `skip_empty_rows=True` was introduced. To include empty rows, put it to False.

Updated
Expand All @@ -52,15 +63,21 @@ Updated
Added
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

#. csv format: handle utf-16 encoded csv files. Potentially being able to decode other formats if correct "encoding" is provided
#. csv format: write utf-16 encoded files. Potentially other encoding is also supported
#. csv format: handle utf-16 encoded csv files. Potentially being able to decode
other formats if correct "encoding" is provided
#. csv format: write utf-16 encoded files. Potentially other encoding is also
supported
#. support stdin as input stream and stdout as output stream

Updated
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

#. Attention, user of pyexcel-io! No longer io stream validation is performed in python 3. The guideline is: io.StringIO for csv, tsv only, otherwise BytesIO for xlsx, xls, ods. You can use RWManager.get_io to produce a correct stream type for you.
#. `#15 <https://github.com/pyexcel/pyexcel-io/issues/15>`__, support foreign django/sql foreign key
#. Attention, user of pyexcel-io! No longer io stream validation is performed
in python 3. The guideline is: io.StringIO for csv, tsv only, otherwise
BytesIO for xlsx, xls, ods. You can use RWManager.get_io to produce a correct
stream type for you.
#. `#15 <https://github.com/pyexcel/pyexcel-io/issues/15>`__, support foreign
django/sql foreign key

0.2.0 - 01.06.2016
--------------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

project = u'pyexcel-io'
copyright = u'2015-2016 Onni Software Ltd.'
version = '0.2.4'
release = '0.2.5'
version = '0.2.5'
release = '0.2.6'
exclude_patterns = []
pygments_style = 'sphinx'
html_theme = 'default'
Expand Down
4 changes: 2 additions & 2 deletions pyexcel_io.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
overrides: "pyexcel.yaml"
name: "pyexcel-io"
nick_name: io
version: 0.2.5
release: 0.2.4
version: 0.2.6
release: 0.2.5
dependencies:
- ordereddict;python_version<"2.7"
extra_dependencies:
Expand Down
5 changes: 4 additions & 1 deletion pyexcel_io/database/django.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,15 @@ class DjangoBookWriter(BookWriter):

def open_content(self, file_content, **keywords):
self.importer = file_content
self.keywords = keywords

def create_sheet(self, sheet_name):
sheet_writer = None
model = self.importer.get(sheet_name)
if model:
sheet_writer = DjangoModelWriterNew(model)
sheet_writer = DjangoModelWriterNew(
model,
batch_size=self.keywords.get('batch_size', None))
return sheet_writer


Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

NAME = 'pyexcel-io'
AUTHOR = 'C.W.'
VERSION = '0.2.5'
VERSION = '0.2.6'
EMAIL = 'wangc_2011 (at) hotmail.com'
LICENSE = 'New BSD'
DESCRIPTION = (
Expand Down
5 changes: 4 additions & 1 deletion tests/test_django_book.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ def setUp(self):
{'B': 6, 'A': 3, 'C': 9}]

def test_save_to_more_models(self):
sample_batch_size = 10
model1 = FakeDjangoModel()
model2 = FakeDjangoModel()
importer = DjangoModelImporter()
Expand All @@ -277,11 +278,13 @@ def test_save_to_more_models(self):
adapter2.get_name(): self.content['Sheet2'][1:]
}
writer = DjangoBookWriter()
writer.open_content(importer)
writer.open_content(importer, batch_size=sample_batch_size)
writer.write(to_store)
writer.close()
assert model1.objects.objs == self.result1
assert model2.objects.objs == self.result2
assert model1.objects.batch_size == sample_batch_size
assert model2.objects.batch_size == sample_batch_size

def test_reading_from_more_models(self):
model1 = FakeDjangoModel()
Expand Down

0 comments on commit 58e541c

Please sign in to comment.