def official(request): if request.method == 'POST': form = BroadcastOfficialForm(data=request.REQUEST) if form.is_valid(): form.save() return HttpResponse() debug(str(form.errors), system="mail-official") return HttpResponse(content=str(form.errors), content_type="text/html", status=406) return HttpResponseNotAllowed(['POST'])
def outgoing_sms(number, body): try: smsObj = _get_client().sms.messages.create(from_=settings.TWILIO_TEXTER, to=number, body=body) except Exception, e: debug(str(e.__dict__), system="twilio-sms") raise TwilioException(e.message)
def process_exception(self, request, exception): debug(traceback.format_exc()) # send_mail('[petri] Exception: %s' % exception, traceback.format_exc(), settings.DEFAULT_EMAIL, settings.ERROR_EMAILS, fail_silently=True) return None
def outgoing_call(number, callback): try: callObj = _get_client().calls.create(from_=settings.TWILIO_CALLER, to=number, url=callback) except Exception, e: debug(str(e.__dict__), system="twilio-call") raise TwilioException(e.message)
def process_exception(self, request, exception): debug(traceback.format_exc()) return None