Mercurial > p > roundup > code
diff roundup/mailer.py @ 3464:75b4c2c32cf3
fix Date: header generation to be LOCALE-agnostic [SF#1352624]
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Fri, 13 Jan 2006 02:38:45 +0000 |
| parents | e49e6c7b14fb |
| children | db856d488de0 |
line wrap: on
line diff
--- a/roundup/mailer.py Fri Jan 13 01:47:07 2006 +0000 +++ b/roundup/mailer.py Fri Jan 13 02:38:45 2006 +0000 @@ -1,7 +1,7 @@ """Sending Roundup-specific mail over SMTP. """ __docformat__ = 'restructuredtext' -# $Id: mailer.py,v 1.10 2004-07-25 15:25:44 a1s Exp $ +# $Id: mailer.py,v 1.11 2006-01-13 02:38:45 richard Exp $ import time, quopri, os, socket, smtplib, re @@ -11,6 +11,12 @@ from roundup.rfc2822 import encode_header from roundup import __version__ +try: + from email.Utils import formatdate +except ImportError: + def formatdate(timeval): + return time.strftime("%a, %d %b %Y %H:%M:%S +0000", timeval) + class MessageSendError(RuntimeError): pass @@ -54,8 +60,7 @@ writer.addheader('Subject', encode_header(subject, charset)) writer.addheader('To', ', '.join(to)) writer.addheader('From', author) - writer.addheader('Date', time.strftime("%a, %d %b %Y %H:%M:%S +0000", - time.gmtime())) + writer.addheader('Date', formatdate(time.gmtime())) # Add a unique Roundup header to help filtering writer.addheader('X-Roundup-Name', encode_header(tracker_name,
