Esempio n. 1
0
File: views.py Progetto: ymc/hue
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")
Esempio n. 2
0
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)
Esempio n. 3
0
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)