Let's use what the stdlib provides us. Use `email.utils.formatdate` instead of `strftime()` a `datetime` object.

This commit is contained in:
Pedro Algarvio 2011-04-14 09:29:40 +01:00
parent 42e1e2fd20
commit 5bc304470c
1 changed files with 3 additions and 2 deletions

View File

@ -38,7 +38,7 @@
#
import smtplib
from datetime import datetime
from email.utils import formatdate
from twisted.internet import defer, threads
from deluge import component
from deluge.event import known_events
@ -125,7 +125,8 @@ Date: %(date)s
""" % {'smtp_from': self.config['smtp_from'],
'subject': subject,
'smtp_recipients': to_addrs,
'date': datetime.utcnow().strftime('%a, %d %b %Y %H:%M:%S +0000').strip()}
'date': formatdate()
}
message = '\r\n'.join((headers + message).splitlines())