This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author timb07
Recipients barry, r.david.murray, timb07
Date 2017-06-16.03:19:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1497583154.94.0.661253483129.issue30681@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2017-06-16 03:19:14timb07setrecipients: + timb07, barry, r.david.murray
2017-06-16 03:19:14timb07setmessageid: <1497583154.94.0.661253483129.issue30681@psf.upfronthosting.co.za>
2017-06-16 03:19:14timb07linkissue30681 messages
2017-06-16 03:19:14timb07create