id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc,branch,changelog,apichanges,internalchanges 12825,OverflowError is raised from to_datetime(),Jun Omae,,"`to_datetime()` has an issue while invoking `pytz.tzinfo.normalize()`: `/timeline?from=0001-01-01T01:00:00Z&daysback=0` {{{ Traceback (most recent call last): File ""build/bdist.linux-x86_64/egg/trac/web/main.py"", line 567, in _dispatch_request dispatcher.dispatch(req) File ""build/bdist.linux-x86_64/egg/trac/web/main.py"", line 249, in dispatch resp = chosen_handler.process_request(req) File ""build/bdist.linux-x86_64/egg/trac/timeline/web_ui.py"", line 181, in process_request timedelta(days=daysback + 1), req.tz) File ""build/bdist.linux-x86_64/egg/trac/util/datefmt.py"", line 177, in to_datetime return tz.normalize(dt) File ""build/bdist.linux-x86_64/egg/trac/util/datefmt.py"", line 1049, in normalize return self.fromutc(dt.replace(tzinfo=self) - dt.utcoffset()) OverflowError: date value out of range }}} `ValueError` also can be raised. {{{ >>> from trac.util.datefmt import to_datetime >>> to_datetime(-10000000000000000000) Traceback (most recent call last): File """", line 1, in File ""/venv/trac/1.0.13/lib/python2.5/site-packages/trac/util/datefmt.py"", line 170, in to_datetime dt = datetime.fromtimestamp(integer - 1, tz) + \ ValueError: year is out of range >>> to_datetime(+10000000000000000000) Traceback (most recent call last): File """", line 1, in File ""/venv/trac/1.0.13/lib/python2.5/site-packages/trac/util/datefmt.py"", line 173, in to_datetime dt = datetime.fromtimestamp(t, tz) ValueError: year is out of range }}} I think we should catch `ValueError` and `OverflowError`, and raise a `TracError` (`TracValueError` if 1.2.1+) rather than. Another case, timeline module has the same issue: `/timeline?from=0001-01-01T01:00:00Z&daysback=3` {{{ Traceback (most recent call last): File ""build/bdist.linux-x86_64/egg/trac/web/main.py"", line 567, in _dispatch_request dispatcher.dispatch(req) File ""build/bdist.linux-x86_64/egg/trac/web/main.py"", line 249, in dispatch resp = chosen_handler.process_request(req) File ""build/bdist.linux-x86_64/egg/trac/timeline/web_ui.py"", line 181, in process_request timedelta(days=daysback + 1), req.tz) OverflowError: date value out of range }}}",defect,new,normal,next-stable-1.6.x,timeline,,normal,,,,,,,