def _fetch_and_parse_messages(self, mailing_list, from_date):
from_date = datetime_to_utc(from_date)<EOL>nmsgs, imsgs, tmsgs = (<NUM_LIT:0>, <NUM_LIT:0>, <NUM_LIT:0>)<EOL>for mbox in mailing_list.mboxes:<EOL><INDENT>tmp_path = None<EOL>try:<EOL><INDENT>tmp_path = self._copy_mbox(mbox)<EOL>for message in self.parse_mbox(tmp_path):<EOL><INDENT>tmsgs += <NUM_LIT:1><EOL>if not self._validate_message(message):<EOL><INDENT>imsgs += <NUM_LIT:1><EOL>continue<EOL><DEDENT>dt = str_to_datetime(message[MBox.DATE_FIELD])<EOL>if dt < from_date:<EOL><INDENT>logger.debug("<STR_LIT>",<EOL>message['<STR_LIT>'], str(from_date))<EOL>tmsgs -= <NUM_LIT:1><EOL>continue<EOL><DEDENT>message = self._casedict_to_dict(message)<EOL>nmsgs += <NUM_LIT:1><EOL>logger.debug("<STR_LIT>", message['<STR_LIT>'])<EOL>yield message<EOL><DEDENT><DEDENT>except (OSError, EOFError) as e:<EOL><INDENT>logger.warning("<STR_LIT>", mbox.filepath, str(e))<EOL><DEDENT>except Exception as e:<EOL><INDENT>if tmp_path and os.path.exists(tmp_path):<EOL><INDENT>os.remove(tmp_path)<EOL><DEDENT>raise e<EOL><DEDENT>finally:<EOL><INDENT>if tmp_path and os.path.exists(tmp_path):<EOL><INDENT>os.remove(tmp_path)<EOL><DEDENT><DEDENT><DEDENT>logger.info("<STR_LIT>",<EOL>nmsgs, tmsgs, imsgs)<EOL>
Fetch and parse the messages from a mailing list