models.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:sndlatr 作者: Schibum 项目源码 文件源码
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()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号