def rss(limit=10): config = model.get_config() #TODO load info from properties # we can create and property for each blog feed = feedgenerator.Rss201rev2Feed(title=config.blogname, link=config.url, feed_url=config.url + "rss", description=config.desc, language=config.lang) posts = model.get_all_posts(limit) for post in posts: feed.add_item(title=post.title, link=request.url_root + post.slug, author_name = post.author.nickname(), description=post.html_content, pubdate = post.when) out = StringIO() feed.write(out, 'utf-8') try: return out.getvalue() finally: out.close()
def new_config(): if model.get_config(): return redirect(url_for('edit_config')) else: return render("config_new.tpl")
def index(): if not model.get_config(): return redirect(url_for('new_config')) else: page = render("index.tpl", posts=model.get_all_posts()) return page