summaryrefslogtreecommitdiffstats
path: root/Lib/email/_parseaddr.py
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2011-03-14 00:06:23 (GMT)
committerR David Murray <rdmurray@bitdance.com>2011-03-14 00:06:23 (GMT)
commitaccd1c040f472f613cdac8fbf78e75794819acfc (patch)
tree8830397de5d56f37dd1413f1ef4c2bb686ee3d80 /Lib/email/_parseaddr.py
parent0cfc23762fb3cc5467d50de020a3b69710884aa5 (diff)
downloadcpython-accd1c040f472f613cdac8fbf78e75794819acfc.zip
cpython-accd1c040f472f613cdac8fbf78e75794819acfc.tar.gz
cpython-accd1c040f472f613cdac8fbf78e75794819acfc.tar.bz2
#1162477: accept '.' in addition to ':' when parsing time in date header.
Some non-compliant MUAs use '.'s, so by the Postel Principle we should accept them. Patch by Thomas Herve.
Diffstat (limited to 'Lib/email/_parseaddr.py')
-rw-r--r--Lib/email/_parseaddr.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/email/_parseaddr.py b/Lib/email/_parseaddr.py
index 41694f9..4b2f5c6 100644
--- a/Lib/email/_parseaddr.py
+++ b/Lib/email/_parseaddr.py
@@ -99,6 +99,14 @@ def parsedate_tz(data):
tss = '0'
elif len(tm) == 3:
[thh, tmm, tss] = tm
+ elif len(tm) == 1 and '.' in tm[0]:
+ # Some non-compliant MUAs use '.' to separate time elements.
+ tm = tm[0].split('.')
+ if len(tm) == 2:
+ [thh, tmm] = tm
+ tss = 0
+ elif len(tm) == 3:
+ [thh, tmm, tss] = tm
else:
return None
try: