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

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

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

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

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

    if 'user' in request_data:
        code, response = Thread.list_by_user(request_data['user'], request_data)
    elif 'forum' in request_data:
        code, response = Thread.list_by_forum(request_data['forum'], request_data)
    else:
        code, response = Codes.NOT_CORRECT, 'Please enter user or forum'

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