Example #1
0
def faultsource(request):
    if request.method == 'PUT':

        json_data = simplejson.loads(request.raw_post_data)
        name = json_data['name']
        fault_id = json_data['fault_id'].split('.')[-1]
        fault = models.Fault.objects.get(pk=fault_id)
        create_faultsource(fault, name)

    return HttpResponse('ok')
Example #2
0
def faultsource(request):
    if request.method == "PUT":

        json_data = simplejson.loads(request.raw_post_data)
        name = json_data["name"]
        fault_id = json_data["fault_id"].split(".")[-1]
        fault = models.Fault.objects.get(pk=fault_id)
        create_faultsource(fault, name)

    return HttpResponse("ok")
Example #3
0
def faultsource(request):
    if request.method == 'PUT':

        json_data = simplejson.loads(request.raw_post_data)
        name = json_data['name']
        fault_id = json_data['fault_id'].split('.')[-1]
        fault = models.Fault.objects.get(pk=fault_id)
        create_faultsource(fault, name)

    return HttpResponse('ok')
Example #4
0
def create_faultsource(request):
    if request.method == 'POST':
        json_data = simplejson.loads(request.raw_post_data)
        fault_id = json_data['fault_id'].split('.')[-1]
        fault = models.Fault.objects.get(pk=fault_id)
        error = utils.create_faultsource(fault)
        if not error:
            return OK_RESPONSE
        else:
            return HttpResponseBadRequest(error)
    else:
        return HttpResponseBadRequest()