Beispiel #1
0
def list_posts():
    request_data = get_json(request)

    if "related" not in request_data:
        request_data["related"] = None

    code, response = Post.list_by_forum(request_data["forum"], request_data, request_data["related"])
    return json.dumps({"code": code, "response": response})
Beispiel #2
0
def list_posts():
    request_data = get_json(request)

    if 'related' not in request_data:
        request_data['related'] = None

    code, response = Post.list_by_forum(request_data['forum'], request_data, request_data['related'])
    return json.dumps(
        {'code': code,
         'response': response}
    )
Beispiel #3
0
def list_posts():
    request_data = get_json(request)

    if 'thread' in request_data:
        code, response = Post.list_by_thread(request_data['thread'], request_data)
    elif 'forum' in request_data:
        code, response = Post.list_by_forum(request_data['forum'], request_data)
    else:
        code, response = Codes.NOT_CORRECT, 'Please enter thread or forum'

    return json.dumps(
        {'code': code,
         'response': response}
    )