Mercurial > p > roundup > code
diff roundup/mailer.py @ 3912:82f462d9ad16
use local timezone for mail date header
fixes [SF#1658173]
| author | Justus Pendleton <jpend@users.sourceforge.net> |
|---|---|
| date | Thu, 20 Sep 2007 19:42:48 +0000 |
| parents | 6d14a3b4e295 |
| children | 7c886f83c2ab |
line wrap: on
line diff
--- a/roundup/mailer.py Thu Sep 20 17:03:17 2007 +0000 +++ b/roundup/mailer.py Thu Sep 20 19:42:48 2007 +0000 @@ -1,7 +1,7 @@ """Sending Roundup-specific mail over SMTP. """ __docformat__ = 'restructuredtext' -# $Id: mailer.py,v 1.19 2007-09-02 05:54:46 jpend Exp $ +# $Id: mailer.py,v 1.20 2007-09-20 19:42:48 jpend Exp $ import time, quopri, os, socket, smtplib, re, sys, traceback @@ -10,6 +10,7 @@ from roundup.rfc2822 import encode_header from roundup import __version__ +from roundup.date import get_timezone try: from email.Utils import formatdate @@ -30,6 +31,11 @@ self.debug = os.environ.get('SENDMAILDEBUG', '') \ or config["MAIL_DEBUG"] + # set timezone so that things like formatdate(localtime=True) + # use the configured timezone + os.environ['TZ'] = get_timezone(self.config.TIMEZONE).tzname(None) + time.tzset() + def get_standard_message(self, to, subject, author=None): '''Form a standard email message from Roundup. @@ -60,7 +66,7 @@ writer.addheader('Subject', encode_header(subject, charset)) writer.addheader('To', ', '.join(to)) writer.addheader('From', author) - writer.addheader('Date', formatdate()) + writer.addheader('Date', formatdate(localtime=True)) # Add a unique Roundup header to help filtering writer.addheader('X-Roundup-Name', encode_header(tracker_name,
