Exemplo n.º 1
0
    def post(self, post_id):
        comment_text = self.request.get('comment')
        #comments can't be empty
        if not comment_text:
            self.response.out.write(json.dumps({'err_msg': True}))
            return

        key = db.Key.from_path('Post', int(post_id))
        post = self.get_post(key)
        comment = Comment(user = self.user,
                          post = post,
                          comment = comment_text)
        comment.put()
        self.response.out.write(comment.render(self.user))