From 5bc304470c8dfc8cccaeaefb17271d84ab2bb47f Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Thu, 14 Apr 2011 09:29:40 +0100 Subject: [PATCH] Let's use what the stdlib provides us. Use `email.utils.formatdate` instead of `strftime()` a `datetime` object. --- deluge/plugins/notifications/notifications/core.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/deluge/plugins/notifications/notifications/core.py b/deluge/plugins/notifications/notifications/core.py index 92c61461d..29cb6c3c9 100644 --- a/deluge/plugins/notifications/notifications/core.py +++ b/deluge/plugins/notifications/notifications/core.py @@ -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())