示例#1
0
def web_category(cid):
    category = Categories.get_by_id(cid)
    if category is None:
        raise notfound()
    page, articles = page_select(Articles, 'where category_id=? and publish_time<?', 'where category_id=? and publish_time<? order by publish_time desc', cid, time.time())
    reads = counters.counts((a._id for a in articles))
    for a, r in zip(articles, reads):
        a.reads = r
    return dict(category=category, page=page, articles=articles)
示例#2
0
def index():
    categories = _get_categories()
    cat_dict = dict(((c._id, c.name) for c in categories))
    fn_get_category_name = lambda cid: cat_dict.get(cid, u'ERROR')
    page, articles = page_select(Articles, '', 'order by publish_time desc')
    return dict( \
        page = page, \
        articles = articles, \
        categories = categories, \
        fn_get_category_name = fn_get_category_name)
示例#3
0
def index():
    categories = _get_categories()
    cat_dict = dict(((c._id, c.name) for c in categories))
    fn_get_category_name = lambda cid: cat_dict.get(cid, u'ERROR')
    page, articles = page_select(Articles, '', 'order by publish_time desc')
    return dict( \
        page = page, \
        articles = articles, \
        categories = categories, \
        fn_get_category_name = fn_get_category_name)
示例#4
0
def web_category(cid):
    category = Categories.get_by_id(cid)
    if category is None:
        raise notfound()
    page, articles = page_select(
        Articles, 'where category_id=? and publish_time<?',
        'where category_id=? and publish_time<? order by publish_time desc',
        cid, time.time())
    reads = counters.counts((a._id for a in articles))
    for a, r in zip(articles, reads):
        a.reads = r
    return dict(category=category, page=page, articles=articles)
示例#5
0
def index():
    page, attachments = page_select(Attachments, '', 'order by creation_time desc')
    return dict(page = page, attachments = attachments)
示例#6
0
def index():
    page, attachments = page_select(Attachments, '',
                                    'order by creation_time desc')
    return dict(page=page, attachments=attachments)
示例#7
0
def index():
    page, users = page_select(Users, '', 'order by creation_time desc')
    return dict(users=users, page=page)
示例#8
0
def index():
    page, cs = page_select(Comments, '', 'order by creation_time desc')
    return dict(comments=cs, page=page)