Commit f91e9f0f authored by nmartensen's avatar nmartensen
Browse files

code simplification

--HG--
branch : 3.0
parent fde8be9ef469
......@@ -200,13 +200,12 @@ class WorkSheetParser(object):
elif value is not None:
if data_type == 'n':
value = _cast_number(value)
if style_id in self.timedelta_formats:
data_type = 'd'
value = from_excel(value, self.epoch, timedelta=True)
elif style_id in self.date_formats:
if style_id in self.date_formats:
data_type = 'd'
try:
value = from_excel(value, self.epoch)
value = from_excel(
value, self.epoch, timedelta=style_id in self.timedelta_formats
)
except ValueError:
msg = """Cell {0} is marked as a date but the serial value {1} is outside the limits for dates. The cell will be treated as an error.""".format(coordinate, value)
warn(msg)
......
......@@ -80,7 +80,7 @@ def WorkSheetParser():
for i in range(29):
styles.add((StyleArray([i]*9)))
styles.add(StyleArray([0,4,6,14,0,1,0,0,0])) #fillId=4, borderId=6, number_format=14 alignmentId=1))
date_formats = set([1, 29])
date_formats = set([1, 29, 30])
timedelta_formats = set([30])
return WorkSheetParser(None, {0:'a'}, date_formats=date_formats, timedelta_formats=timedelta_formats)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment