Как решить проблему с игнорированием оператора if в файле views.py?

Почему оператор if в twilio_view2 игнорируется? Когда это выражение выполняется, оно просто переходит к выражению else. См. ответ TwiML. Заранее спасибо всем, кто поможет.

views.py

from example import test1_is_valid, test2_is_valid

def twilio_view2(request: HttpRequest) -> HttpResponse:
    digits = request.POST.get('Digits')
    response = VoiceResponse()
    if test1_is_valid(digits) and test2_is_valid(digits):
        gather = Gather(input='dtmf', action='/twilio_view3', method='POST')
        gather.say('Blah blah blah.')
        response.append(gather)
    else:
        response.say('Something other than Blah blah blah.')
        response.redirect("/twilio_view1")
    return HttpResponse(str(response), content_type='text/xml')

TwiML ответ

<Response>
    <Say>Something other than Blah blah blah.</Say>
    <Redirect>/twilio_view1</Redirect>
</Response>
Вернуться на верх