Example #1
0
def index():
	twitts, posts, comments, photo, random_posts = util.last_contents()
	# fp = cache.get('featured_posts')
	# if not fp:
	featured_posts = Post.query.filter(Post.featured=='Y')
		#cache.set('featured_posts', featured_posts)
	return render_template('home.html', posts=posts, featured_posts=featured_posts, 
		                                comments=comments, twitts=twitts, 
		                                flickr_photo=photo, random_posts=random_posts)
Example #2
0
def view_post(slug):
	try:
		post = cache.get('view-post-%s' % slug)
		if not post:
			post = Post.query.filter(Post.slug==slug).one()
			cache.set('view-post-%s' % slug, post)
		comentarios = Comment.query.filter(Comment.post_id==post.id,Comment.display==True)
		return render_template('one-post.html',post=post, comentarios=comentarios, sidebar=util.last_contents())
	except NoResultFound as nrf:
		return abort(404)
Example #3
0
def view(slug):
	try:
		pagina = Page.query.filter(Page.slug==slug).one()
		if not pagina:
			return abort(404)
		else:
			if 'partial' in request.args:
				return render_template('pages_view_partial.html', page=pagina)
			else:
				sidebar=util.last_contents()
				return render_template('pages_view.html', page=pagina, sidebar=sidebar)
	except NoResultFound:
		return abort(404)
Example #4
0
def blog_index():
	# print 'POSTS_PER_PAGE', current_app.config['POSTS_PER_PAGE']
	posts = Post.query.order_by("date_created desc").limit(current_app.config['POSTS_PER_PAGE'])
	resp = make_response( render_template('index.html',posts=posts, sidebar=util.last_contents()) )
	resp.set_cookie('blog_page', 1)
	return resp