コード例 #1
0
ファイル: views.py プロジェクト: 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")
コード例 #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)
コード例 #3
0
ファイル: views.py プロジェクト: cloudera/hue
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)