示例#1
0
def thread_list_posts(connect):
    cursor = connect.cursor(cursor_class=MySQLCursorDict)

    req_args = ['thread']
    opt_args = ['since', 'limit', 'sort', 'order']
    thread = extract_req(request.args, req_args)
    since, limit, sort, order = extract_opt(request.args, opt_args)

    posts = get_thread_posts(cursor, thread, since, limit, sort, order)

    cursor.close()
    return response_ok(posts)
示例#2
0
文件: thread.py 项目: xammi/Curs_DB
def thread_list_posts(connect):
    cursor = connect.cursor(cursor_class=MySQLCursorDict)

    req_args = ['thread']
    opt_args = ['since', 'limit', 'sort', 'order']
    thread = extract_req(request.args, req_args)
    since, limit, sort, order = extract_opt(request.args, opt_args)

    posts = get_thread_posts(cursor, thread, since, limit, sort, order)

    cursor.close()
    return response_ok(posts)
示例#3
0
文件: post.py 项目: xammi/Curs_DB
def post_list(connect):
    cursor = connect.cursor(cursor_class=MySQLCursorDict)

    opt_args = ['forum', 'thread', 'since', 'limit', 'sort', 'order']
    short_name, thread, since, limit, sort, order = extract_opt(request.args, opt_args)

    if short_name is None and thread is None:
        raise RequiredNone('forum OR thread')

    posts = []
    if not short_name is None:
        posts = get_forum_posts(cursor, short_name, since, limit, sort, order)
    elif not thread is None:
        posts = get_thread_posts(cursor, thread, since, limit, sort, order)

    cursor.close()
    return response_ok(posts)
示例#4
0
def post_list(connect):
    cursor = connect.cursor(cursor_class=MySQLCursorDict)

    opt_args = ['forum', 'thread', 'since', 'limit', 'sort', 'order']
    short_name, thread, since, limit, sort, order = extract_opt(
        request.args, opt_args)

    if short_name is None and thread is None:
        raise RequiredNone('forum OR thread')

    posts = []
    if not short_name is None:
        posts = get_forum_posts(cursor, short_name, since, limit, sort, order)
    elif not thread is None:
        posts = get_thread_posts(cursor, thread, since, limit, sort, order)

    cursor.close()
    return response_ok(posts)