def render_DELETE(self, request): reply_id = request.get_argument("id") reply = get_reply(request, reply_id) if is_author_or_admin(request, reply): delete_reply(request, reply) request.dbsession.commit() return "success" else: raise Unauthorized()
def render_POST(self, request): reply_id = request.get_argument("id") reply = get_reply(request, reply_id) if is_author(request, reply): content = request.get_argument("content") if content.strip(): edit_reply(request, reply, content) request.dbsession.commit() return "reply edit success" else: raise BadRequest() else: raise Unauthorized()