Skip to content

Commit 59ff8d6

Browse files
committed
update
1 parent e07fa28 commit 59ff8d6

1 file changed

Lines changed: 26 additions & 10 deletions

File tree

Mailman/Queue/VirginRunner.py

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -125,17 +125,33 @@ def _dispose(self, mlist, msg, msgdata):
125125
mailman_log('debug', 'VirginRunner._dispose: Starting to process virgin message %s (file: %s)',
126126
msgid, filebase)
127127

128-
# Get the IncomingRunner class
129-
from Mailman.Queue import get_incoming_runner
130-
IncomingRunner = get_incoming_runner()
128+
# Ensure we have a MailList object
129+
if isinstance(mlist, str):
130+
try:
131+
mlist = MailList.MailList(mlist, lock=0)
132+
should_unlock = True
133+
except Errors.MMUnknownListError:
134+
mailman_log('error', 'VirginRunner: Unknown list %s', mlist)
135+
self._shunt.enqueue(msg, msgdata)
136+
return
137+
else:
138+
should_unlock = False
131139

132-
# Process the message using IncomingRunner's _dispose method
133-
result = IncomingRunner._dispose(self, mlist, msg, msgdata)
134-
135-
mailman_log('debug', 'VirginRunner._dispose: Finished processing virgin message %s (file: %s)',
136-
msgid, filebase)
137-
138-
return result
140+
try:
141+
# Get the IncomingRunner class
142+
from Mailman.Queue import get_incoming_runner
143+
IncomingRunner = get_incoming_runner()
144+
145+
# Process the message using IncomingRunner's _dispose method
146+
result = IncomingRunner._dispose(self, mlist, msg, msgdata)
147+
148+
mailman_log('debug', 'VirginRunner._dispose: Finished processing virgin message %s (file: %s)',
149+
msgid, filebase)
150+
151+
return result
152+
finally:
153+
if should_unlock:
154+
mlist.Unlock()
139155

140156
def _get_pipeline(self, mlist, msg, msgdata):
141157
# It's okay to hardcode this, since it'll be the same for all

0 commit comments

Comments
 (0)