Mercurial > p > roundup > code
diff roundup/mailer.py @ 3467:8fcee705ebdb maint-0.8
merge from HEAD
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Fri, 13 Jan 2006 03:34:34 +0000 |
| parents | e49e6c7b14fb |
| children | 5603e08ac6fc |
line wrap: on
line diff
--- a/roundup/mailer.py Fri Jan 13 01:44:02 2006 +0000 +++ b/roundup/mailer.py Fri Jan 13 03:34:34 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.10.2.1 2006-01-13 03:34:34 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,
