fix uploads

This commit is contained in:
Sanj 2011-02-09 00:15:25 +05:30
parent 4eccf28b83
commit 4cb2dc8131

View File

@ -60,7 +60,11 @@ def add_folder(request):
category.save()
user = request.user
# import pdb;pdb.set_trace()
shutil.move(join(FTP_ROOT, folder_name), join(UPLOAD_ROOT, folder_name))
n = 1
while os.path.exists(join(UPLOAD_ROOT, folder_name)):
n += 1
folder_name = u'%s (%s)' % (form.cleaned_data['folder_name'], n)
shutil.move(join(FTP_ROOT, folder_name), UPLOAD_ROOT)
File.addFiles(category, user, folder_name)
return render_to_response("files/added_folder.html", {
'folder_name': folder_name,