datatracker
datatracker copied to clipboard
utc_from_string() method replicates Python library code
Describe the issue
The code behind utc_from_string() in ietf/ipr/mail.py should be simplified now that support for python < 3.3 has been dropped.
There are two wrinkles I see:
- the datatracker of
parsedate_to_datetime()catchesValueErrorand returnsNoneif it is unable to parse the timezone - the standard
parsedate_to_datetime()returns a naivedatetimeif the string specified-0000
I think both are easy to iron out: for the first, catching ValueError and returning None should preserve the behavior; for the second, the timestamp should be assigned datetime.timezone.utc if its tzinfo is None.
Code of Conduct
- [X] I agree to follow the IETF's Code of Conduct