[ python-Bugs-1162477 ] Parsing failures in parsedate_tz

SourceForge.net noreply at sourceforge.net
Sun Mar 20 11:36:48 CET 2005


Bugs item #1162477, was opened at 2005-03-13 18:11
Message generated for change (Comment added) made by tzot
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1162477&group_id=5470

Category: Python Library
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: TH (therve)
Assigned to: Nobody/Anonymous (nobody)
Summary: Parsing failures in parsedate_tz

Initial Comment:
Some email clients send bad-formed datetimes, not
parsed by parsedate_tz (both rfc822.py and
email._parseaddr.py). 

The format not recognized is "HH.MM.SS".

I don't know if it's worth taking in account but in
doubt I give a small patch for email._parseaddr :

----------------------------------------------------------------
@@ -90,6 +100,14 @@ def parsedate_tz(data):
         tss = '0'
     elif len(tm) == 3:
         [thh, tmm, tss] = tm
+    elif len(tm) == 1:
+        # Small hack to get HH.MM.ss
+        tm = tm[0].split(".")
+        if len(tm) == 2:
+            [thh, tmm] = tm
+            tss = '0'
+        elif len(tm) == 3:
+            [thh, tmm, tss] = tm
     else:
         return None
----------------------------------------------------------------

----------------------------------------------------------------------

Comment By: Christos Georgiou (tzot)
Date: 2005-03-20 12:36

Message:
Logged In: YES 
user_id=539787

It would be helpful if you could provide some of these
malformed Date headers, so that test cases can be generated.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1162477&group_id=5470


More information about the Python-bugs-list mailing list