def admin_articles(req): check_login(req) match_right(req, module_rights) show = req.args.getfirst('show', '', uni) pager = Pager(sort='desc') pager.bind(req.args) kwargs = {} if show == 'ready': pager.set_params(show=show) kwargs['state'] = 2 kwargs['public_date'] = 0 elif show == 'drafts': pager.set_params(show=show) kwargs['state'] = 1 else: show = None if not do_check_right(req, right_editor): kwargs['author_id'] = req.login.id items = Article.list(req, pager, **kwargs) return generate_page(req, "admin/articles.html", pager=pager, items=items, show=show)
def articles_rss(req): pager = Pager(limit=5, sort='desc', order='create_date') items = Article.list(req, pager, perex=True, public=1) for it in items: if it.format == FORMAT_RST: it.perex = rst2html(it.perex) return generate_page(req, "articles_rss.xml", content_type="application/xml", pager=pager, items=items, lang=get_lang(req), tzname=tzname, webmaster=req.server_admin)
def articles_list_full(req, locale=None, tag=None): pager = Pager(limit=5, sort='desc', order='create_date') pager.bind(req.args) kwargs = {'locale': (locale, '')} if locale else {} items = Article.list(req, pager, perex=True, public=1, tag=tag, **kwargs) for it in items: if it.format == FORMAT_RST: it.perex = rst2html(it.perex) lang = locale if locale else get_lang(req) return generate_page(req, "articles_list.html", pager=pager, items=items, lang=lang, staticmenu=req.cfg.get_static_menu(req))