def create_new_comment(): logging.info("creating new comment") logging.info(request.json) comment = models.Comment( text=request.json.get('text'), author=request.json.get('author') ) comment.put() response.content_type = 'application/json' return models.comment_to_json(comment)
def get_all_comments(): logging.info("Getting all comments!") comments = models.Comment.query().order(models.Comment.created).fetch(100) to_return = [models.comment_to_json(comment) for comment in comments] response.content_type = 'application/json' return json.dumps(to_return)