def get_feed(): created = repository.creation_datetime updated = repository.update_datetime feed = { 'id': helpers.tag_uri(host, created, repository_path), 'self': request.url, 'title': repository.description, 'updated': updated, 'entries': [ { 'authors': post.authors, 'content': post.content, 'id': helpers.tag_uri(host, post.creation_datetime, post.path.encode('utf-8')), 'title': post.title or helpers.get_first_sentence_from_html(post.content) + ' …', 'updated': post.update_datetime, 'url': urljoin( 'http://%s:%s' % (host, port), url('post', slug=quote(post.filename.encode('utf-8'))) ), } for post in sorted(repository.posts, key=lambda p: \ p.update_datetime, reverse=True) ] } response.headers['Content-Type'] = 'application/atom+xml' return feed
def index(): response = { 'username': username(request.auth), 'title': repository.description, 'posts': [ { 'title': post.title or helpers.get_first_sentence_from_html(post.content) + ' …', 'created': post.creation_datetime, 'url': urljoin( '//%s:%s' % (host, port), url('post', slug=quote(post.filename.encode('utf-8'))) ), } for post in sorted(repository.posts, key=lambda p: \ p.creation_datetime, reverse=True) ] } return response