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)
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)
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)
def index(): page, attachments = page_select(Attachments, '', 'order by creation_time desc') return dict(page = page, attachments = attachments)
def index(): page, attachments = page_select(Attachments, '', 'order by creation_time desc') return dict(page=page, attachments=attachments)
def index(): page, users = page_select(Users, '', 'order by creation_time desc') return dict(users=users, page=page)
def index(): page, cs = page_select(Comments, '', 'order by creation_time desc') return dict(comments=cs, page=page)