Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Mailman/Handlers/FileRecips.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ def process(mlist, msg, msgdata):
msgdata['recips'] = []
return
# Read all the lines out of the file, and strip them of the trailing nl
addrs = [line.strip() for line in fp.readlines()]
with fp:
addrs = [line.strip() for line in fp.readlines()]
# If the sender is in that list, remove him
sender = msg.get_sender()
if mlist.isMember(sender):
Expand Down
12 changes: 11 additions & 1 deletion Mailman/Handlers/ToDigest.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ def process(mlist, msg, msgdata):
try:
with open(mboxfile, 'a+b') as mboxfp:
mbox = Mailbox(mboxfp.name)
mbox.AppendMessage(msg)
try:
mbox.AppendMessage(msg)
finally:
mbox.close()
# Calculate the current size of the accumulation file. This will not tell
# us exactly how big the MIME, rfc1153, or any other generated digest
# message will be, but it's the most easily available metric to decide
Expand Down Expand Up @@ -155,6 +158,13 @@ def send_digests(mlist, mboxfp):

def send_i18n_digests(mlist, mboxfp):
mbox = Mailbox(mboxfp)
try:
_send_i18n_digests(mlist, mbox)
finally:
mbox.close()


def _send_i18n_digests(mlist, mbox):
# Prepare common information (first lang/charset)
lang = mlist.preferred_language
lcset = Utils.GetCharSet(lang)
Expand Down