@require_POST
@require_can_edit_web_users
def test_repeater(request, domain):
    url = request.POST["url"]
    repeater_type = request.POST['repeater_type']
    format = request.POST.get('format', None)
    repeater_class = repeater_types[repeater_type]
    form = GenericRepeaterForm(
        {"url": url, "format": format},
        domain=domain,
        repeater_class=repeater_class
    )
    if form.is_valid():
        url = form.cleaned_data["url"]
        format = format or RegisterGenerator.default_format_by_repeater(repeater_class)
        generator_class = RegisterGenerator.generator_class_by_repeater_format(repeater_class, format)
        generator = generator_class(repeater_class())
        fake_post = generator.get_test_payload()
        headers = generator.get_headers()

        try:
            resp = simple_post(fake_post, url, headers=headers)
            if resp.status_code < 300 <= 200:
                return HttpResponse(json.dumps({"success": True,
                                                "response": resp.content,
                                                "status": resp.status_code}))
            else:
                return HttpResponse(json.dumps({"success": False,
                                                "response": resp.content,
                                                "status": resp.status_code}))

        except Exception, e:
            errors = str(e)
        return HttpResponse(json.dumps({"success": False, "response": errors}))
    else:
        return HttpResponse(json.dumps({"success": False, "response": "Please enter a valid url."}))
dataset/ETHPy150Open dimagi/commcare-hq/corehq/apps/domain/views.py/test_repeater/swapped operands of `<=`