Merge lp:~aanand0071/mailman/967951 into lp:mailman

Proposed by Aanand on 2015-03-05
Status: Needs review
Proposed branch: lp:~aanand0071/mailman/967951
Merge into: lp:mailman
Diff against target: 33 lines (+7/-0)
1 file modified
src/mailman/runners/lmtp.py (+7/-0)
To merge this branch: bzr merge lp:~aanand0071/mailman/967951
Reviewer Review Type Date Requested Status
Barry Warsaw 2015-03-05 Needs Fixing on 2015-05-14
Review via email: mp+251906@code.launchpad.net

Description of the change

Added patch for bug #967951

To post a comment you must log in.
Barry Warsaw (barry) wrote :

Can you write some tests for this change?

review: Needs Fixing

Unmerged revisions

7302. By Aanand on 2015-03-04

patch for bug #967951

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'copybump.py' (properties changed: +x to -x)
2=== modified file 'cron/crontab.in.in' (properties changed: +x to -x)
3=== modified file 'src/mailman/runners/lmtp.py'
4--- src/mailman/runners/lmtp.py 2015-01-05 01:22:39 +0000
5+++ src/mailman/runners/lmtp.py 2015-03-05 11:20:26 +0000
6@@ -53,6 +53,7 @@
7 from mailman.utilities.datetime import now
8 from mailman.utilities.email import add_message_hash
9 from zope.component import getUtility
10+from mailman.interfaces.messages import IMessageStore
11
12
13 elog = logging.getLogger('mailman.error')
14@@ -93,6 +94,7 @@
15 ERR_502 = '502 Error: command HELO not implemented'
16 ERR_550 = '550 Requested action not taken: mailbox unavailable'
17 ERR_550_MID = '550 No Message-ID header provided'
18+ERR_550_DID = '550 Duplicate Message ID'
19
20 # XXX Blech
21 smtpd.__version__ = 'Python LMTP runner 1.0'
22@@ -185,6 +187,11 @@
23 # Do basic post-processing of the message, checking it for defects or
24 # other missing information.
25 message_id = msg.get('message-id')
26+ msg_obj = getUtility(IMessageStore)
27+ try:
28+ msg_obj.add(msg)
29+ except ValueError as e:
30+ return ERR_550_DID
31 if message_id is None:
32 return ERR_550_MID
33 if msg.defects: