Skip to content

Commit d67b242

Browse files
committed
input: Don't assume that header/path are str
1 parent dbd1a14 commit d67b242

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
99
### Fixed
1010

1111
- Don't fail if compiled translation files (.mo) don't exist, and Django isn't installed
12+
- Fix some incorrect assumptions about types
1213

1314
## [0.15.1] - 2020-10-21
1415

flattentool/i18n.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def _(text):
2626
if lang not in translations:
2727
lang = "en"
2828
return translations[lang].gettext(text)
29+
2930
except FileNotFoundError:
3031
# If .mo files don't exist, pass a fake gettext function instead
3132
_ = lambda x: x

flattentool/input.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,11 @@ def get_sheet_lines(self, sheet_name):
752752
if not header:
753753
# None means that the cell will be ignored
754754
value = None
755-
elif sheet_configuration.get("hashcomments") and header.startswith("#"):
755+
elif (
756+
sheet_configuration.get("hashcomments")
757+
and isinstance(header, str)
758+
and header.startswith("#")
759+
):
756760
# None means that the cell will be ignored
757761
value = None
758762
output_row[header] = value
@@ -945,7 +949,7 @@ def unflatten_main_with_parser(parser, line, timezone, xml, id_name):
945949
# Quick solution to avoid casting of date as datetinme in spreadsheet > xml
946950
if xml:
947951
if type(cell.cell_value) == datetime.datetime and not next_path_item:
948-
if "datetime" not in path:
952+
if "datetime" not in str(path):
949953
current_type = "date"
950954

951955
## Array

0 commit comments

Comments
 (0)