def delete(request, key): form = FileConfirmDeleteForm(request.form) if request.method == "POST" and form.validate(): if form.drop.data is True: File.drop(key) return redirect(url_for('nut:files/list'), 301) if form.cascade.data is True: File.drop(key, cascade=True) return redirect(url_for('nut:files/list'), 301) file = File.get(key) files = dict([(n.get_key(), n) for n in File.all().filter("ancestors = ", key)]) file = rec(file, files) return render_template('app:files/confirm_delete.html', file=file, form=form)