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)
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)
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)
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)