def delete_blog(): """Delete blog. :param id: blog id. """ blog_id = request.json.get('blog_id', None) api_blog.delete(api_blog.get_or_404(blog_id)) return jsonify(dict(success=True))
def delete_blog(blog_id): """Delete blog. :param id: blog id. """ blog = api_blog.get(blog_id) if blog.user != current_user: return jsonres(rv=None, metacode=403, msg=u'这不是您的,你不能删除', code=403) api_blog.delete(api_blog.get_or_404(blog_id)) return jsonres()