def forum_list_threads():
    connection = dbConnector.connect()
    params = functions.get_json(request)
    optional = functions.get_optional(params, ["since", "limit", "order"])
    related = functions.get_related(params)
    try:
        functions.check(params, ["forum"])
        response = thread.list(connection=connection, optional=optional,
                               required=params, related=related)
    except Exception, e:
        connection.close()
        return json.dumps({"code": 3, "response": e.message})
def list_thread():

    connection = dbConnector.connect()

    params = functions.get_json(request)

    optional = functions.get_optional(
        request=params, values=["since", "limit", "order"])

    try:
        response = thread.list(connection=connection, required=params,
                               optional=optional, related=[])
    except Exception as e:
        connection.close()
        return json.dumps({"code": 1, "response": e.message})

    connection.close()
    return json.dumps({"code": 0, "response": response})