Skip to content

Commit 6a51169

Browse files
committed
Merge branch 'feature/tabular-datetime' into develop
Closes #409 [ENG-9901]
2 parents 9cbb16d + 3393e76 commit 6a51169

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

mfr/extensions/tabular/utilities.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import re
22
import xlrd
3+
from datetime import datetime
34

45
from http import HTTPStatus
56
from subprocess import (check_call,
@@ -114,12 +115,18 @@ def to_bytes(fp):
114115
raise TypeError("Expected binary file-like object; got text/str")
115116

116117

118+
def _convert_value(value):
119+
if isinstance(value, datetime):
120+
return value.isoformat()
121+
return value
122+
123+
117124
def _extract_rows(fields, raw_rows):
118125
rows = []
119126
for row in raw_rows:
120127
if len(rows) >= MAX_SIZE:
121128
break
122-
rows.append(dict(zip(fields, row)))
129+
rows.append(dict(zip(fields, map(_convert_value, row))))
123130
return rows
124131

125132

0 commit comments

Comments
 (0)