Message296154
My proposed solution (in https://github.com/python/cpython/pull/2229) is two-part:
1. change parsedate_to_datetime() to return None rather than raising an exception; and
2. change headerregistry.DateHeader.parse() to check for None being returned from parsedate_to_datetime(), and to add a defect; the datetime attribute is set to None (as if the Date header were missing), but the header still evaluates as a string to the supplied header value.
I'm not sure what the use case is for distinguishing between a missing Date header and an invalid date value, but can't that be distinguished by the different defects added to the header?
In any case, if I'm not fully grasping the context and parsedate_to_datetime() should continue to throw exceptions, then a slightly different modification to DateHeader to catch those exceptions would seem sensible, and would address my use case. |
|
Date |
User |
Action |
Args |
2017-06-16 03:19:14 | timb07 | set | recipients:
+ timb07, barry, r.david.murray |
2017-06-16 03:19:14 | timb07 | set | messageid: <1497583154.94.0.661253483129.issue30681@psf.upfronthosting.co.za> |
2017-06-16 03:19:14 | timb07 | link | issue30681 messages |
2017-06-16 03:19:14 | timb07 | create | |
|