def GET(self): user = users.get_current_user() if user and users.is_current_user_admin(): posts = models.get_all_posts() return render.admin(user.nickname(), posts) else: raise web.redirect(users.create_login_url('/admin'))
def recent_feed(): feed = AtomFeed('Recente', feed_url=request.url, url=request.url_root) articles = get_all_posts()[:config.FEEDS_MAX_POSTS] for article in articles: feed.add(article.title, content=unicode(article.get_content()), content_type='html', author='<your name here>', url=article.url, updated=article.get_datetime(), published=article.get_datetime()) return feed.get_response()
def get(self): user = users.get_current_user() if user: email = user.email() auth_url = users.create_logout_url(dest_url='/') else: email = None auth_url = users.create_login_url(dest_url='/') self.response.write( jinja_environment.get_template('index.html').render( email=email, is_admin=users.is_current_user_admin(), auth_url=auth_url, posts=models.get_all_posts()))
def posts_list(): posts = get_all_posts() return render_template('all_posts.html', posts=posts)
def post(post_url): actual_post = get_post_by_url(post_url) return render_template('post.html', post=actual_post, menu_posts=get_all_posts())
def books(): return render_template('books.html', menu_posts=get_all_posts())
def about(): return render_template('about.html', menu_posts=get_all_posts())
def index(): return render_template('index.html', posts=get_all_posts()[:config.HOME_MAX_POSTS], menu_posts=get_all_posts())
def GET(self): ''' Get all the posts ''' posts = models.get_all_posts() return render.archive(posts)