@@ -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