Beispiel #1
0
 def post(self):
     user = User.logged_in_user() 
     if user:
         payload = request.json or {}
         comment = payload.get('comment')
         post_key    = payload.get('key')
         author = Node.get_by_id(user.id)
         post = Node.get_by_id(post_key)
         comment_node = Service.create_comment(author, comment, post)
         return {'status': 'success', 'node': comment_node.__dict__, 'message': 'Successfully posted the comment'}
     else:
         return {'status': 'error', 'message': 'Please login first.'}