Esempio n. 1
0
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
Esempio n. 2
0
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
Esempio n. 3
0
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
Esempio n. 4
0
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