示例#1
0
 def get(self, **kw):
     post_id = self.request.get('post_id')
     post = Post.by_id(int(post_id))
     comments = Comment.query(ancestor=post.key)
     comments = comments.order(-Comment.created)
     comments = comments.fetch(5)
     user_name = ""
     user_is_author = False
     if self.user:
         user_name = self.user.name
         if post.author and user_name == post.author:
             user_is_author = True
     self.render('viewpost.html',
                 post=post,
                 user_name=user_name,
                 user_is_author=user_is_author,
                 comments=comments,
                 **kw)