Exemple #1
0
def ajax_form(request, form):
    f = SIPURIForm(form)
    response = {}
    if f.is_valid():
        data = f.cleaned_data
        try:
            data = OptionsRequest.get(data['uri'])
        except OptionsRequestError, e:
            response['error'] = str(e)
        else:
            response['status'] = simplejson.loads(data)
Exemple #2
0
def ajax_form(request, form):
    f = SIPURIForm(form)
    response = {}
    if f.is_valid():
        data = f.cleaned_data
        try:
            data = OptionsRequest.get(data['uri'])
        except OptionsRequestError, e:
            response['error'] = str(e)
        else:
            response['status'] = simplejson.loads(data)
Exemple #3
0
def index(request):
    if request.method == "POST":
        form = SIPURIForm(request.POST)
        context = {"form": form}
        if form.is_valid():
            data = form.cleaned_data
            try:
                data = OptionsRequest.get(data["uri"])
            except OptionsRequestError, e:
                context["error"] = e
            else:
                context["status"] = simplejson.loads(data)
        else:
            context["error"] = "; ".join((", ".join(value) for value in form.errors.values()))