示例#1
0
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'))
示例#2
0
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()
示例#3
0
def add_link():
	return render("add_link.tpl")
示例#4
0
def configure():
	model.configure(request.form)
	return render("config_edit.tpl", saved=True)
示例#5
0
def edit_config():
	return render("config_edit.tpl", saved=False)
示例#6
0
def new_config():
	if model.get_config():
		return redirect(url_for('edit_config'))
	else:
		return render("config_new.tpl")
示例#7
0
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
示例#8
0
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
示例#9
0
def tag(tag):
	# TODO check tpl page
	return render("index.tpl", posts=model.get_posts_by_tag(tag))
示例#10
0
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
示例#11
0
def drafts():
	page = render("drafts.tpl", posts=model.get_all_drafts())
	return page
示例#12
0
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
示例#13
0
def config_analytics():
	return render("config_analytics.tpl")
示例#14
0
def config_twitter():
	return render("config_twitter.tpl")