diff options
author | R. David Murray <rdmurray@bitdance.com> | 2010-08-25 01:55:24 (GMT) |
---|---|---|
committer | R. David Murray <rdmurray@bitdance.com> | 2010-08-25 01:55:24 (GMT) |
commit | 1061f18bebb808c95cde8c8a0a7d55e7ed87dbc6 (patch) | |
tree | ee4a9c73b9a4ca575445930055d872ff905a13f6 /Lib/email/_parseaddr.py | |
parent | e21624fb4558753ddc0b3fe2379d74d1f45f9d26 (diff) | |
download | cpython-1061f18bebb808c95cde8c8a0a7d55e7ed87dbc6.zip cpython-1061f18bebb808c95cde8c8a0a7d55e7ed87dbc6.tar.gz cpython-1061f18bebb808c95cde8c8a0a7d55e7ed87dbc6.tar.bz2 |
Merged revisions 84310 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r84310 | r.david.murray | 2010-08-24 20:45:55 -0400 (Tue, 24 Aug 2010) | 8 lines
#1194222: make parsedate always return RFC2822 four character years.
Two character years are now converted to four character years using
the Posix standard rule (<68 == 2000, >=68==1900). This makes the
parsed date RFC2822 compliant even if the input is not.
Patch and test by Jeffrey Finkelstein.
........
Diffstat (limited to 'Lib/email/_parseaddr.py')
-rw-r--r-- | Lib/email/_parseaddr.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/email/_parseaddr.py b/Lib/email/_parseaddr.py index 81913a3..ac2e524 100644 --- a/Lib/email/_parseaddr.py +++ b/Lib/email/_parseaddr.py @@ -107,6 +107,18 @@ def parsedate_tz(data): tss = int(tss) except ValueError: return None + # Check for a yy specified in two-digit format, then convert it to the + # appropriate four-digit format, according to the POSIX standard. RFC 822 + # calls for a two-digit yy, but RFC 2822 (which obsoletes RFC 822) + # mandates a 4-digit yy. For more information, see the documentation for + # the time module. + if yy < 100: + # The year is between 1969 and 1999 (inclusive). + if yy > 68: + yy += 1900 + # The year is between 2000 and 2068 (inclusive). + else: + yy += 2000 tzoffset = None tz = tz.upper() if tz in _timezones: |