[Mailman-Developers] pipermail.py and self.datestr

SHIGENO Kazutaka shigeno at iij-mc.co.jp
Tue Mar 9 13:18:28 EST 2004


Hi,

Please see the following page.

 http://mail.python.org/pipermail/mailman-developers/2004-March.txt.gz

The date headers in the page are RFC2822 violation.

 Date: Mon Mar  1 21:01:02 2004
 Date: Tue Mar  2 08:29:07 2004
 Date: Tue Mar  2 08:40:05 2004
 ...

This is because the following code is performed in HyperArch.py.

    def as_text(self):
        d = self.__dict__.copy()
        # We need to guarantee a valid From_ line, even if there are
        # bososities in the headers.
        if not d.get('fromdate', '').strip():
            d['fromdate'] = time.ctime(time.time())
        if not d.get('email', '').strip():
            d['email'] = 'bogus at does.not.exist.com'
        if not d.get('datestr', '').strip():
            d['datestr'] = time.ctime(time.time())
	#

Since there is no datestr, time.ctime() is used.

I think that the following patch solves this problem.

From: SHIGENO Kazutaka <shigeno at iij-mc.co.jp>
Date: Fri, 20 Feb 2004 23:10:13 +0900 (JST)

> The definition of self.datestr does not exist in pipermail.py.
> How about using the following patch?
> 
> --- pipermail.py        7 Jan 2004 02:41:46 -0000       1.1.1.1
> +++ pipermail.py        20 Feb 2004 13:19:33 -0000
> @@ -240,6 +240,11 @@
>          self._last_article_time = date
>          self.date = '%011i' % date
> 
> +        datestr = message.get('date', None)
> +        if datestr is None:
> +            datestr = message.get('x-list-received-date', None)
> +        self.datestr = datestr
> +
>      def __repr__(self):
>          return '<Article ID = '+repr(self.msgid)+'>'

-- shigeno



More information about the Mailman-Developers mailing list