def disable_if_replied(self, auth_token):
""" Checks if there was a reply and disables job if there was. """
logging.info('processing disable_if_replied for {}'.format(self.key))
if self.state != 'checking':
logging.warn('job not in checking state, skipping')
return
if not self.only_if_noreply:
logging.warn('only_if_noreply not configured, skipping')
self.state = 'scheduled'
self.put()
return
mailman = gmail.Mailman(self.user_email, auth_token)
try:
reply = self.find_reply(mailman)
finally:
mailman.quit()
if reply is not None:
logging.info('reply found, disabling job')
self.state = 'disabled'
self.disabled_reply = DisabledReply.from_gmail_dict(reply)
self.put()
else:
self.state = 'scheduled'
self.put()
评论列表
文章目录