+
+
+@require_POST
+def mkdir(request):
+ check_auth(request)
+
+ # TODO actual data validation
+ form = NewDirForm(request.POST)
+
+ if form.is_valid():
+ host = form.cleaned_data['host']
+ path = form.cleaned_data['path']
+ name = form.cleaned_data['name']
+
+ url = 'gsiftp://' + host + path + '/' + name
+
+ print url
+
+ try:
+ FTPOperation(request.session['proxy']).mkdir(url)
+ except FTPException as e:
+ msg = e.message
+ else:
+ return JsonResponse({'success': True})
+ else:
+ msg = form.errors
+
+ return JsonResponse({'msg': msg}, status=400)