Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions libcove/lib/converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,6 @@
logger = logging.getLogger(__name__)


def filter_conversion_warnings(conversion_warnings):
out = []
for w in conversion_warnings:
if w.category is flattentool.exceptions.DataErrorWarning:
out.append(str(w.message))
else:
logger.warning(w)
return out


@cove_spreadsheet_conversion_error
def convert_spreadsheet(
upload_dir,
Expand All @@ -36,7 +26,18 @@ def convert_spreadsheet(
xml=False,
xml_schemas=None,
cache=True,
conversion_warning_hook=lambda w: str(w.message),
):

def filter_conversion_warnings(conversion_warnings):
out = []
for w in conversion_warnings:
if w.category is flattentool.exceptions.DataErrorWarning:
out.append(conversion_warning_hook(w))
else:
logger.warning(w)
return out

context = {}
if xml:
output_file = "unflattened.xml"
Expand Down