예제 #1
0
파일: post.py 프로젝트: neuront/nijipress
def by_tag(t, page=0, count=util.ITEMS_PER_PAGE):
    post_ids = [r.post_id for r in db.Query(tag.TagPostR).filter('tag =', t)]
    post_ids = sorted(post_ids, reverse=True)[count * page:count * (page + 1)]
    return [
        post.init_tags(tag.tags_by_post_id(post.pid)).fix_fields()
        for post in db.Query(Post).filter('pid in', post_ids).order('-date')
    ]
예제 #2
0
파일: post.py 프로젝트: neuront/nijipress
 def fetch_posts(start_index, count):
     if count <= 0:
         return []
     return [
         p.init_tags(tag.tags_by_post_id(p.pid))
         for p in db.Query(Post).order('-date').fetch(count,
                                                      offset=start_index)
     ]
예제 #3
0
파일: post.py 프로젝트: neuront/nijipress
def by_id(ident):
    post_id = int(ident)
    posts = db.Query(Post).filter('pid =', post_id)
    if posts.count() == 0:
        raise ValueError('no such post')
    return posts[0].init_tags(tag.tags_by_post_id(post_id)).fix_fields()
예제 #4
0
파일: post.py 프로젝트: neuront/nijinote
def by_id(ident):
    post_id = int(ident)
    posts = db.Query(Post).filter('pid =', post_id)
    if posts.count() == 0:
        raise ValueError('no such post')
    return posts[0].init_tags(tag.tags_by_post_id(post_id))
예제 #5
0
파일: post.py 프로젝트: neuront/nijinote
def by_tag(t, page=0, count=util.ITEMS_PER_PAGE):
    post_ids = [r.post_id for r in db.Query(tag.TagPostR).filter('tag =', t)]
    post_ids = sorted(post_ids, reverse=True)[count * page: count * (page + 1)]
    return [post.init_tags(tag.tags_by_post_id(post.pid)) for post in
                      db.Query(Post).filter('pid in', post_ids).order('-date')]
예제 #6
0
파일: post.py 프로젝트: neuront/nijinote
 def fetch_posts(start_index, count):
     if count <= 0:
         return []
     return [p.init_tags(tag.tags_by_post_id(p.pid)) for p in
                   db.Query(Post).order('-date')
                                 .fetch(count, offset=start_index)]
예제 #7
0
파일: post.py 프로젝트: synee/abillist
def _load_cache():
    return [p.init_tags(tag.tags_by_post_id(p.pid))
            for p in db.Query(Post).order('-date').fetch(util.ITEMS_PER_PAGE)]
예제 #8
0
파일: post.py 프로젝트: synee/abillist
def fetch(page=0, count=util.ITEMS_PER_PAGE):
    if page == 0:
        return _first_page_posts(count)
    return [post.init_tags(tag.tags_by_post_id(post.pid)) for post in
            db.Query(Post).order('-date').fetch(count, count * page)]
예제 #9
0
def _load_cache():
    return [p.init_tags(tag.tags_by_post_id(p.pid))
            for p in db.Query(Post).order('-date').fetch(util.ITEMS_PER_PAGE)]
예제 #10
0
def fetch(page=0, count=util.ITEMS_PER_PAGE):
    if page == 0:
        return _first_page_posts(count)
    return [post.init_tags(tag.tags_by_post_id(post.pid)) for post in
       db.Query(Post).order('-date').fetch(count, count * page)]