Opened 18 years ago
Closed 17 years ago
#5322 closed defect (fixed)
ValueError raised when due date for milestone is too large
Reported by: | vbs | Owned by: | osimons |
---|---|---|---|
Priority: | normal | Milestone: | 0.11 |
Component: | ticket system | Version: | devel |
Severity: | normal | Keywords: | datetime |
Cc: | mstepniowski@… | Branch: | |
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
Trac raises ValueError when you assign date from year 2038 onwards to milestone due date (*). This exception is never catched.
The problem is with this two lines, maybe more:
(*) As is stated in Python documentation:
fromtimestamp() may raise ValueError, if the timestamp is out of the range of values supported by the platform C localtime() or gmtime() functions.
Sorry for my bad english. I'm a foreign speaker.
Attachments (1)
Change History (8)
comment:1 by , 17 years ago
comment:2 by , 17 years ago
Priority: | high → normal |
---|---|
Severity: | major → normal |
comment:4 by , 17 years ago
Owner: | changed from | to
---|
The 'Versions' admin page shows the same behaviour on such dates.
We need at least provide standard error pages instead of displaying the traceback.
by , 17 years ago
Attachment: | t5322-r6317-date_valuerror-a.diff added |
---|
Patch that ensures that we can convert to and from timestamp before accepting input as a valid date.
follow-up: 6 comment:5 by , 17 years ago
Keywords: | review datetime added |
---|---|
Status: | new → assigned |
Think I found it. What happens is that we:
- Parse the date correctly
- We convert it to a timestamp
- And we save it to the database
Problem is, as you correctly noticed, that it cannot be converted back if the underlying C localtime()
and gmtime()
functions use 32-bit ints for counting seconds since epoch. That puts the limit some time in 2038.
I've made a patch to the Trac parse_date()
metod that basically does the conversion to and from timestamp, and raises an error if the date does not pass this test.
Please test t5322-r6317-date_valuerror-a.diff.
comment:6 by , 17 years ago
Replying to osimons:
I've made a patch to the Trac
parse_date()
method that basically does the conversion to and from timestamp, and raises an error if the date does not pass this test.
Great idea! That seems very robust this way. However IIUC, the error we trap in this case is not due to a wrong format, but to an out of bound condition, so the error message should rather indicate that.
comment:7 by , 17 years ago
Keywords: | review removed |
---|---|
Milestone: | 0.11.1 → 0.11 |
Resolution: | → fixed |
Status: | assigned → closed |
Fixed the error message a little, and applied in [6318].
Closing.
#5403 was closed as duplicate.