예제 #1
0
def vote(request):
    """
    Vote request (page that is hit when Twilio routes the SMS to CTRL+FREAK)
    """
    data = {}
    template = 'message.xml'
    
    try:
        twilio_data = {}
        twilio_data['From'] = request.GET.get('From')
        twilio_data['Body'] = request.GET.get('Body').upper().strip()    
        
        msg = twilio.process_twilio_vote_request(twilio_data)
        data['msg'] = msg
    except:
        # Something we expected from the SMS was missing
        template = 'txterror.xml'
    
    # Time to render
    return render_to_response(template, data, context_instance=RequestContext(request))
예제 #2
0
def fake_vote(request):
    """
    Fake vote request ( a vote that is initiated from the channel page, a hack
    to allow for quick vote testing with need of cell phone )
    """
    data = {}
    template = 'message.xml'
    
    try:
        twilio_data = {}
        choice = request.GET.get('choice').upper().strip()
        code = request.GET.get('code').upper().strip()
        
        twilio_data['From'] = 'FAKE'
        twilio_data['Body'] = code + '+' + choice    
        
        msg = twilio.process_twilio_vote_request(twilio_data)
        data['msg'] = msg
    except:        
        template = 'txterror.xml'
    
    # Time to render
    return render_to_response(template, data, context_instance=RequestContext(request))