def delete_comment(self, request): article = main.Articles(parent=main.archive_key()).get_by_id( request.article_id, parent=main.archive_key()) pickled = main.db.Text(dumps(['deleted', '', datetime.now()])) article.comments[request.comment_id] = pickled article.put() return message_types.VoidMessage()
def set_article_view(self, request): article = main.Articles(parent=main.archive_key()).get_by_id( request.id, parent=main.archive_key()) #if article.author == main.users.get_current_user(): #old-style if article.author == main.oAuthUsers.get_current_user(): article.view = request.view article.put() return ErrorInfo() return ErrorInfo(error_code=1, error_info='signed in user is not the author')
def edit_comment(self, request): article = main.Articles(parent=main.archive_key()).get_by_id( request.article_id, parent=main.archive_key()) #nickname = main.users.get_current_user() #old-style nickname = main.oAuthUsers.get_current_user().nickname() pickled = main.db.Text( dumps([request.comment_text, nickname, datetime.now()])) article.comments[request.comment_id] = pickled article.put() return message_types.VoidMessage()
def post_comment(self, request): article = main.Articles(parent=main.archive_key()).get_by_id( request.article_id, parent=main.archive_key()) #nickname = main.users.get_current_user() #old-style nickname = main.oAuthUsers.get_current_user().nickname() pickled = main.db.Text( dumps([request.comment_text, nickname, datetime.now()])) article.comments.append(pickled) article.put() comment_id = len(article.comments) - 1 return CommentInfo(comment_id=comment_id, user_url='todo', user_activity='todo', nickname=str(nickname))
def edit_comment(self, request): article = main.Articles(parent=main.archive_key()).get_by_id(request.article_id, parent=main.archive_key()) nickname = main.users.get_current_user() pickled = main.db.Text(dumps([request.comment_text, nickname, datetime.now()])) article.comments[request.comment_id] = pickled article.put() return message_types.VoidMessage()
def set_article_view(self, request): article = main.Articles(parent=main.archive_key()).get_by_id(request.id, parent=main.archive_key()) if article.author == main.users.get_current_user(): article.view = request.view article.put() return ErrorInfo() return ErrorInfo(error_code = 1, error_info = 'signed in user is not the author')
def post_article(self, request): article = main.Articles(parent=main.archive_key()) article.author = main.users.get_current_user() article.embed = request.embed article.title = request.title article.content = request.content article.tags = request.tags article.view = "Preview" article.put() return message_types.VoidMessage()
def post_article(self, request): article = main.Articles(parent=main.archive_key()) #article.author = main.users.get_current_user() article.author = main.oAuthUsers.get_current_user() article.embed = request.embed article.title = request.title article.content = request.content article.tags = request.tags article.view = "Preview" article.put() return message_types.VoidMessage()
def post_comment(self, request): article = main.Articles(parent=main.archive_key()).get_by_id(request.article_id, parent=main.archive_key()) nickname = main.users.get_current_user() pickled = main.db.Text(dumps([request.comment_text, nickname, datetime.now()])) article.comments.append(pickled) article.put() comment_id = len(article.comments) - 1 return CommentInfo( comment_id = comment_id, user_url = 'todo', user_activity = 'todo', nickname = str(nickname))
def delete_comment(self, request): article = main.Articles(parent=main.archive_key()).get_by_id(request.article_id, parent=main.archive_key()) pickled = main.db.Text(dumps(['deleted', '', datetime.now()])) article.comments[request.comment_id] = pickled article.put() return message_types.VoidMessage()
def get_comments(self, request): for comment in main.Articles.get_by_id(request.article_id, parent=main.archive_key()).comments loads(comment) #structure the return return "not implemented - incomplete stub"