rfc822 module problem

Francois Pinard pinard at iro.umontreal.ca
Thu May 15 18:46:01 EDT 2003


Hi, people.  Here is a little session transcript:

---------------------------------------------------------------------->
Python 2.2.2 (#1, Jan 21 2003, 20:10:11) 
[GCC 3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from __future__ import nested_scopes, generators, division
>>> import rfc822
>>> pd = rfc822.parsedate_tz
>>> pd('12, May 2003 14:16:47 +')
None
>>> pd('Mon, 12, May 2003 14:16:47 +')
(2003, 5, 12, 14, 16, 47, 0, 0, 0, None)
>>> pd('12 May 2003 14:16:47 +')
(2003, 5, 12, 14, 16, 47, 0, 0, 0, None)
>>>
----------------------------------------------------------------------<

I would not think a comma is allowed after the day in an RFC822 date, so
my guess is that the first and third `pd()' above return a correct answer,
while the second `pd()' should ideally return None, instead of being too
permissive.  Or else, if it has to be permissive, then the first `pd()'
should be permissive as well.  (I got its string from a spam message.)

About accepting a trailing ` +', this does not look right to my naive
eyes, but maybe RFC822 does describe this as a degenerate zone reference,
I do not know.  I would have expected that trailing ` +' to be rejected,
and that all `pd()' return None.

Would someone, having access to the latest development Python, be kind
enough to check if the behaviour is the same, or different?  The question
remains however, about what should the behaviour ideally be...

-- 
François Pinard   http://www.iro.umontreal.ca/~pinard





More information about the Python-list mailing list