예제 #1
0
def statements_more_get(req_dict):
    stmt_result, attachments = retrieve_statement.get_statement_request(req_dict['more_id'])     
    content_length = len(json.dumps(stmt_result))
    mime_type = "application/json"

    # If there are attachments, include them in the payload
    if attachments:
        stmt_result, mime_type, content_length = build_response(stmt_result, content_length)
        resp = HttpResponse(stmt_result, mimetype=mime_type, status=200)
    # If not, just dump the stmt_result
    else:
        resp = HttpResponse(json.dumps(stmt_result), mimetype=mime_type, status=200)
    
    # Add consistent header and set content-length
    try:
        resp['X-Experience-API-Consistent-Through'] = str(models.Statement.objects.latest('stored').stored)
    except:
        resp['X-Experience-API-Consistent-Through'] = str(datetime.now())
    resp['Content-Length'] = str(content_length)
    return resp
예제 #2
0
def statements_more_get(req_dict):
    statement_result = retrieve_statement.get_statement_request(req_dict['more_id']) 
    return HttpResponse(json.dumps(statement_result),mimetype="application/json",status=200)