def get(cls, post_id=None, as_json=False): render = cls._render_json if as_json else cls._render_html post = get_or_404(PostManager.get_by_id, post_id) attachment = get_or_404(post.get_attachment) metadata = attachment.get_metadata() previous, next = PostManager.get_adjacent_by_id(post_id) return render(post, attachment, metadata, previous, next)
def get_rss2(cls): posts, has_next = PostManager.get_all(limit=cls.ITEM_LIMIT) return IndexView(items=posts, has_next=has_next, mode=IndexView.MODE_SINCE).render_rss2()
def get_sitemap(cls): posts, has_next = PostManager.get_all() return IndexView(items=posts, has_next=has_next, mode=IndexView.MODE_SINCE).render_sitemap()