Ejemplo n.º 1
0
def get_post_info_params(cursor, post_info, related_list):
    user_info = post_info[4]
    thread_info = post_info[2]
    forum_info = post_info[5]
    for related in related_list:
        if related == 'user':
            user_info = get_user_info_external(cursor, post_info[4])
        elif related == 'thread':
            thread_info = get_thread_info_external(cursor, post_info[2])
        elif related == 'forum':
            forum_info = get_forum_info_external(cursor, post_info[5])

    resp = {
        "date": datetime.datetime.strftime(post_info[1], "%Y-%m-%d %H:%M:%S"),
        "dislikes": post_info[13],
        "forum": forum_info,
        "id": post_info[0],
        "isApproved": true_false_ret(post_info[7]),
        "isDeleted": true_false_ret(post_info[11]),
        "isEdited": true_false_ret(post_info[9]),
        "isHighlighted": true_false_ret(post_info[8]),
        "isSpam": true_false_ret(post_info[10]),
        "likes": post_info[12],
        "message": post_info[3],
        "parent": zero_check(post_info[6]),
        "points": post_info[14],
        "thread": thread_info,
        "user": user_info
    }
    return resp
Ejemplo n.º 2
0
def get_post_info(post_info):
    resp = {
        "date": datetime.datetime.strftime(post_info[1], "%Y-%m-%d %H:%M:%S"),
        "dislikes": post_info[13],
        "forum": post_info[5],
        "id": post_info[0],
        "isApproved": true_false_ret(post_info[7]),
        "isDeleted": true_false_ret(post_info[11]),
        "isEdited": true_false_ret(post_info[9]),
        "isHighlighted": true_false_ret(post_info[8]),
        "isSpam": true_false_ret(post_info[10]),
        "likes": post_info[12],
        "message": post_info[3],
        "parent": zero_check(post_info[6]),
        "points": post_info[14],
        "thread": post_info[2],
        "user": post_info[4]
    }
    return resp
Ejemplo n.º 3
0
def get_post_info(post_info):
    resp = {
        "date": datetime.datetime.strftime(post_info[1], "%Y-%m-%d %H:%M:%S"),
        "dislikes": post_info[13],
        "forum": post_info[5],
        "id": post_info[0],
        "isApproved": true_false_ret(post_info[7]),
        "isDeleted": true_false_ret(post_info[11]),
        "isEdited": true_false_ret(post_info[9]),
        "isHighlighted": true_false_ret(post_info[8]),
        "isSpam": true_false_ret(post_info[10]),
        "likes": post_info[12],
        "message": post_info[3],
        "parent": zero_check(post_info[6]),
        "points": post_info[14],
        "thread": post_info[2],
        "user": post_info[4]
    }
    return resp