def get(self, post_id): post_key = 'POST_' + post_id post, age = age_get(post_key) if not post: key = db.Key.from_path('Post', int(post_id), parent=blog_key) post = db.get(key) age_set(post_key, post) age = 0 if not post: self.error(404) return if self.format == 'html': self.render("permalink.html", p = post, age = age_str(age)) elif self.format == 'json': self.render_json(post.as_dict())
def get(self): posts, age = get_posts() if self.format == 'html': self.render('blogfront.html', posts = posts, age = age_str(age)) elif self.format == 'json': return self.render_json([p.as_dict() for p in posts])