def delete(request, id, path): cluster = get_cluster_or_404(id) redir = {} if request.method == 'POST': zk = ZooKeeper(cluster['rest_url']) try: zk.recursive_delete(path) except ZooKeeper.NotFound: pass redir = { 'redirect': reverse('zookeeper:tree', kwargs={'id':id, 'path': path[:path.rindex('/')] or '/'}) } return HttpResponse(json.dumps(redir), mimetype="application/json")
def delete(request, id, path): if not is_admin(request.user): raise PopupException(_('You are not a superuser')) cluster = get_cluster_or_404(id) redir = {} if request.method == 'POST': zk = ZooKeeper(cluster['rest_url']) try: zk.recursive_delete(path) except ZooKeeper.NotFound: pass redir = { 'redirect': reverse('zookeeper:tree', kwargs={'id':id, 'path': path[:path.rindex('/')] or '/'}) } return JsonResponse(redir)
def delete(request, id, path): if not is_admin(request.user): raise PopupException(_('You are not a superuser')) cluster = get_cluster_or_404(id) redir = {} if request.method == 'POST': zk = ZooKeeper(cluster['rest_url']) try: zk.recursive_delete(path) except ZooKeeper.NotFound: pass redir = { 'redirect': reverse('zookeeper:tree', kwargs={'id':id, 'path': path[:path.rindex('/')] or '/'}) } return JsonResponse(redir)