channel.py 文件源码

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

项目:daisychain 作者: daisychainme 项目源码 文件源码
def handle_action(self, action_type, userid, inputs):
        log.debug("handle action: action_type: {} userid: {}, inputs: {}".format(action_type,
                                                                                 userid,
                                                                                 inputs))
        try:
            user = User.objects.get(pk=userid)
        except User.DoesNotExist:
            log.error("User does not exist")
            return

        try:
            mail_account = MailAccount.objects.get(user=user)
        except MailAccount.DoesNotExist:
            log.error('No MailAccount corresponding to the user')
            return

        # action
        if action_type == SEND_EMAIL:
            log.debug('handle action: send_email called')
            self.send_email(mail_account=mail_account,
                            subject=inputs['subject'],
                            body=inputs['body'])
        else:
            raise NotSupportedAction()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号