def sms_send(user, content): try: conn = Connection.objects.get(contact__user=user) except: print 'user [%s] has no contact info; can\'t send sms alert' % user_name(user) logging.exception('error retriving contact info for user [%s]; can\'t send sms alert' % user_name(user)) return send_message(conn, content) print 'sent sms alert to [%s]' % user_name(user)
def action_caption(action, alert, user): username = user_name(user) if action == 'fu': if alert.status == 'esc': return '%s claimed the escalated issue' % username else: return '%s is following up' % username elif action == 'esc': esc_class = alert.escalation_level_name(alert.escalation_level) # alert must have already been escalated if user is None: # auto-escalated by system return 'issue has been automatically escalated to %s, due to how long it has been open' % esc_class else: return '%s escalated the issue to %s' % (username, esc_class) elif action == 'resolve': return '%s resolved the issue' % username