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')
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")
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()