def create(request, id, path): if not request.user.is_superuser: raise PopupException(_('You are not a superuser')) cluster = get_cluster_or_404(id) if request.method == 'POST': form = CreateZNodeForm(request.POST) if form.is_valid(): zk = ZooKeeper(cluster['rest_url']) full_path = ("%s/%s" % (path, form.cleaned_data['name'])).replace( '//', '/') zk.create(full_path, form.cleaned_data['data'], sequence=form.cleaned_data['sequence']) return tree(request, id, path) else: form = CreateZNodeForm() return render( 'create.mako', request, { 'cluster': cluster, 'path': path, 'form': form, 'clusters': CLUSTERS.get(), })
def create(request, id, path): cluster = get_cluster_or_404(id) if request.method == 'POST': form = CreateZNodeForm(request.POST) if form.is_valid(): zk = ZooKeeper(cluster['rest_url']) full_path = ("%s/%s" % (path, form.cleaned_data['name'])).replace('//', '/') zk.create(full_path, form.cleaned_data['data'], sequence = form.cleaned_data['sequence']) return tree(request, id, path) else: form = CreateZNodeForm() return render('create.mako', request, {'cluster': cluster, 'path': path, 'form': form, 'clusters': CLUSTERS.get(),})