Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 5
0
def index():
    page, attachments = page_select(Attachments, '', 'order by creation_time desc')
    return dict(page = page, attachments = attachments)
Exemplo n.º 6
0
def index():
    page, attachments = page_select(Attachments, '',
                                    'order by creation_time desc')
    return dict(page=page, attachments=attachments)
Exemplo n.º 7
0
def index():
    page, users = page_select(Users, '', 'order by creation_time desc')
    return dict(users=users, page=page)
Exemplo n.º 8
0
def index():
    page, cs = page_select(Comments, '', 'order by creation_time desc')
    return dict(comments=cs, page=page)