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()
评论列表
文章目录