def _feed_rss(url): feed = AtomFeed(title=site.sitename(), subtitle='Recent Articles', feed_url=url + 'feed/rss', url=url, updated=datetime.now()) for post in ServiceMixin.post_service.get_published_posts(): feed.add(post.title, markdown(post.html), content_type='html', author=post.user.username, url=url + 'post/' + post.slug, updated=post.updated, published=post.created) return ''.join(feed.generate())
def _feed_json(url): posts = [] for post in ServiceMixin.post_service.get_published_posts(): data = dict(author=post.user.username, html=markdown(post.html), url=urljoin(url, '/post/' + post.slug), updated=post.updated, published=post.created) posts.append(data) rss = { 'sitename': site.sitename(), 'site': url, 'updated': datetime.now(), 'description': site.description(), 'posts': posts } return rss
def _feed_json(url): posts = [] for post in ServiceMixin.post_service.get_published_posts(): data = dict(author=post.user.username, html=markdown(post.html), url=urljoin( url , '/post/' + post.slug), updated=post.updated, published=post.created ) posts.append(data) rss = { 'sitename': site.sitename(), 'site': url, 'updated': datetime.now(), 'description': site.description(), 'posts': posts } return rss