예제 #1
0
파일: dao-old.py 프로젝트: dudefu/xnote
def list_recent_viewed(creator=None, offset=0, limit=10):
    # where = "is_deleted = 0 AND (creator = $creator)"
    # db = xtables.get_file_table()
    # result = list(db.select(where = where,
    #         vars   = dict(creator = creator),
    #         order  = "atime DESC",
    #         offset = offset,
    #         limit  = limit))

    if limit is None:
        limit = xconfig.PAGE_SIZE

    user = xauth.current_name()
    if user is None:
        user = "******"

    id_list = dbutil.zrange("note_visit:%s" % user, -offset - 1,
                            -offset - limit)
    note_dict = batch_query(id_list)
    files = []

    for id in id_list:
        note = note_dict.get(id)
        if note:
            files.append(note)
    fill_parent_name(files)
    return files
예제 #2
0
파일: dao.py 프로젝트: Alawnwei/xnote
def list_recent_edit(creator=None, offset=0, limit=None):
    """通过KV存储实现"""
    if limit is None:
        limit = xconfig.PAGE_SIZE

    id_list = dbutil.zrange("note_recent:%s" % creator, -offset - 1,
                            -offset - limit)
    note_dict = batch_query(id_list)
    files = []

    for id in id_list:
        note = note_dict.get(id)
        if note:
            files.append(note)
    fill_parent_name(files)
    return files
예제 #3
0
파일: dao.py 프로젝트: arong-me/xnote
def list_recent_viewed(creator = None, offset = 0, limit = 10):
    if limit is None:
        limit = xconfig.PAGE_SIZE

    user = xauth.current_name()
    if user is None:
        user = "******"
    
    id_list   = dbutil.zrange("note_visit:%s" % user, -offset-1, -offset-limit)
    note_dict = batch_query(id_list)
    files     = []

    for id in id_list:
        note = note_dict.get(id)
        if note:
            files.append(note)
    fill_parent_name(files)
    return files
예제 #4
0
파일: dao.py 프로젝트: arong-me/xnote
def list_recent_edit(parent_id = None, offset=0, limit=None):
    """通过KV存储实现"""
    if limit is None:
        limit = xconfig.PAGE_SIZE

    user = xauth.current_name()
    if user is None:
        user = "******"
    
    id_list   = dbutil.zrange("note_recent:%s" % user, -offset-1, -offset-limit)
    note_dict = batch_query(id_list)
    files     = []

    for id in id_list:
        note = note_dict.get(id)
        if note:
            files.append(note)
    fill_parent_name(files)
    return files