def edit_post(key): post = model.get_post_by_key(key) if post: if post.as_draft: return render("post_edit.tpl", post=post, draft=True, tags=",".join(post.tags)) else: return render("post_edit.tpl", post=post,tags=",".join(post.tags)) else: # todo: error message return redirect(url_for('index'))
def __update_sitemap(sitemap): """ Updates the given sitemap. Updates the content, save it to DS and to cache. """ sitemap.content = render("sitemap.tpl", posts=get_all_posts()) sitemap.put() memcache.set("sitemap", sitemap) memcache.delete("sitemap_view") ping_services()
def add_link(): return render("add_link.tpl")
def configure(): model.configure(request.form) return render("config_edit.tpl", saved=True)
def edit_config(): return render("config_edit.tpl", saved=False)
def new_config(): if model.get_config(): return redirect(url_for('edit_config')) else: return render("config_new.tpl")
def page_not_found(error): page = memcache.get('error_view') if not page: page = render('not_found.tpl') memcache.set('error_view', page) return page, 404
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
def tag(tag): # TODO check tpl page return render("index.tpl", posts=model.get_posts_by_tag(tag))
def slug(slug): post = model.get_post_by_slug(slug) if not post: return abort(404) page = render("post_view.tpl", post=post) return page
def drafts(): page = render("drafts.tpl", posts=model.get_all_drafts()) return page
def new_post(): page = memcache.get('post_new_view') if not page: page = render("post_new.tpl") memcache.set('post_new_view', page) return page
def config_analytics(): return render("config_analytics.tpl")
def config_twitter(): return render("config_twitter.tpl")