Exemplo n.º 1
0
def get_staged_diff_internal(request):
    try:
        return HttpResponse(
            json.dumps(get_staged_diff(json.loads(
                request.body)['channel_id'])))
    except Exception as e:
        return HttpResponseServerError(content=str(e), reason=str(e))
Exemplo n.º 2
0
def get_staged_diff_endpoint(request):
    if request.method == 'POST':
        return HttpResponse(
            json.dumps(get_staged_diff(json.loads(
                request.body)['channel_id'])))

    return HttpResponseBadRequest(
        "Only POST requests are allowed on this endpoint.")
Exemplo n.º 3
0
def get_staged_diff_internal(request):
    try:
        channel_id = json.loads(request.body)['channel_id']
        request.user.can_edit(channel_id)
        return Response(get_staged_diff(channel_id))
    except (Channel.DoesNotExist, PermissionDenied):
        return HttpResponseNotFound(
            "No channel matching: {}".format(channel_id))
    except Exception as e:
        handle_server_error(request)
        return HttpResponseServerError(content=str(e), reason=str(e))
Exemplo n.º 4
0
def get_staged_diff_endpoint(request):
    if request.method == 'POST':
        return HttpResponse(
            json.dumps(get_staged_diff(json.loads(
                request.body)['channel_id'])))
Exemplo n.º 5
0
def get_staged_diff_internal(request):
    return HttpResponse(
        json.dumps(get_staged_diff(json.loads(request.body)['channel_id'])))
Exemplo n.º 6
0
def get_staged_diff_internal(request):
    try:
        return HttpResponse(json.dumps(get_staged_diff(json.loads(request.body)['channel_id'])))
    except Exception as e:
        handle_server_error(request)
        return HttpResponseServerError(content=str(e), reason=str(e))