def delete_comment(post_id, comment_id): try: posts.delete_comment(post_id, comment_id) except PostNotFound: return xmpp_template('post_not_found', post_id=post_id) except CommentNotFound: return xmpp_template('comment_not_found', post_id=post_id, comment_id=comment_id) except CommentAuthorError: return xmpp_template('comment_del_denied', post_id=post_id, comment_id=comment_id) return xmpp_template('comment_del', post_id=post_id, comment_id=comment_id)
def delete(id): comment_id = env.request.args('comment_id') try: if comment_id: post = posts.delete_comment(id, comment_id) if env.owner: login = post.author.login.lower() else: post = Post(id) login = post.author.login.lower() return Response(redirect='%s://%s.%s/%s' % \ (env.request.protocol, login, settings.domain, id)) else: posts.delete_post(id) return Response(redirect='%s://%s.%s/blog' % \ (env.request.protocol, env.user.login.lower(), settings.domain)) except PostAuthorError: raise SubscribeError
def delete_comment(id, comment_id): try: posts.delete_comment(id, comment_id) except PostAuthorError: raise SubscribeError