[ python-Bugs-1249573 ] rfc822 module, bug in parsedate_tz
SourceForge.net
noreply at sourceforge.net
Mon Jan 22 22:10:59 CET 2007
Bugs item #1249573, was opened at 2005-08-01 13:56
Message generated for change (Comment added) made by gbrandl
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1249573&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Extension Modules
Group: Python 2.4
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: nemesis (nemesis_xpn)
Assigned to: Nobody/Anonymous (nobody)
Summary: rfc822 module, bug in parsedate_tz
Initial Comment:
I found that the function parsedate_tz of the rfc822
module has a bug (or at least I think so).
I found a usenet article (message-id:
<2714d.q75200 at myg.winews.net>)
that has this Date field:
Date: Tue,26 Jul 2005 13:14:27 GMT +0200
It seems to be correct¹, but parsedate_tz is not able
to decode it, it
is confused by the absence of a space after the ",".
I studied the parsedate_tz code and the problem is on
its third line:
...
if not data:
return None
data = data.split()
...
After the split I have:
['Tue,26', 'Jul', '2005', '13:14:27', 'GMT', '+0200']
but "Tue," and "26" should be separated.
Of course parsedate_tz correctly decode the field if
you add a space after the ",".
A possible solution is to change the line n°863 of
rfc822.py (data=data.split()) with this one:
data=data.replace(",",", ").split()
it solves the problem and should not affect the normal
behaviour.
¹ and looking at rfc2822 par3.3 it should be correct,
the space after
the comma is not mandatory:
date-time = [ day-of-week "," ] date FWS
time [CFWS]
day-of-week = ([FWS] day-name) / obs-day-of-week
day-name = "Mon" / "Tue" / "Wed" / "Thu" /
"Fri" / "Sat" / "Sun"
date = day month year
----------------------------------------------------------------------
>Comment By: Georg Brandl (gbrandl)
Date: 2007-01-22 21:10
Message:
Logged In: YES
user_id=849994
Originator: NO
Fixed in rev. 53522, 53523 (2.5).
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1249573&group_id=5470
More information about the Python-bugs-list
mailing list