💚 convert print to log. resolves #112

This commit is contained in:
chfw 2022-01-28 23:47:23 +00:00
parent b66ccfc062
commit d2cbb5decf
4 changed files with 17 additions and 7 deletions

View File

@ -1,6 +1,12 @@
name: pyexcel-io
organisation: pyexcel
releases:
- changes:
- action: updated
details:
- "`#112`: Log "Empty Row Warning" instead 'print' "
version: 0.6.6
date: 31.1.2022
- changes:
- action: updated
details:

View File

@ -3,9 +3,9 @@ project: "pyexcel-io"
name: pyexcel-io
nick_name: io
version: 0.6.5
current_version: 0.6.5
release: 0.6.5
copyright_year: 2015-2020
current_version: 0.6.6
release: 0.6.6
copyright_year: 2015-2022
moban_command: false
is_on_conda: true
dependencies:

View File

@ -31,7 +31,7 @@ class DjangoModelWriter(ISheetWriter):
def write_row(self, array):
if is_empty_array(array):
print(constants.MESSAGE_EMPTY_ARRAY)
log.warning(constants.MESSAGE_EMPTY_ARRAY)
else:
new_array = swap_empty_string_for_none(array)
if self.mapdict:

View File

@ -7,10 +7,14 @@
:copyright: (c) 2014-2020 by Onni Software Ltd.
:license: New BSD License, see LICENSE for more details
"""
import logging
import pyexcel_io.constants as constants
from pyexcel_io.utils import is_empty_array, swap_empty_string_for_none
from pyexcel_io.plugin_api import IWriter, ISheetWriter
LOG = logging.getLogger(__name__)
class PyexcelSQLSkipRowException(Exception):
"""
@ -35,14 +39,14 @@ class SQLTableWriter(ISheetWriter):
def write_row(self, array):
if is_empty_array(array):
print(constants.MESSAGE_EMPTY_ARRAY)
LOG.warning(constants.MESSAGE_EMPTY_ARRAY)
else:
new_array = swap_empty_string_for_none(array)
try:
self._write_row(new_array)
except PyexcelSQLSkipRowException:
print(constants.MESSAGE_IGNORE_ROW)
print(new_array)
LOG.info(constants.MESSAGE_IGNORE_ROW)
LOG.info(new_array)
def _write_row(self, array):
new_array = array