projects
/
qcg-portal.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
use temporary location for uploaded file (*.part), rename after successful finish
[qcg-portal.git]
/
filex
/
uploadhandler.py
diff --git
a/filex/uploadhandler.py
b/filex/uploadhandler.py
index
0f5bfb3
..
75a6cd7
100644
(file)
--- a/
filex/uploadhandler.py
+++ b/
filex/uploadhandler.py
@@
-9,6
+9,8
@@
from filex.ftp import FTPOperation
class FtpUploadHandler(FileUploadHandler):
ftp = None
class FtpUploadHandler(FileUploadHandler):
ftp = None
+ url = None
+ tmp_url = None
def new_file(self, file_name, *args, **kwargs):
super(FtpUploadHandler, self).new_file(file_name, *args, **kwargs)
def new_file(self, file_name, *args, **kwargs):
super(FtpUploadHandler, self).new_file(file_name, *args, **kwargs)
@@
-24,7
+26,10
@@
class FtpUploadHandler(FileUploadHandler):
if self.ftp is None:
self.ftp = FTPOperation(self.request.session['proxy'], self.chunk_size)
if self.ftp is None:
self.ftp = FTPOperation(self.request.session['proxy'], self.chunk_size)
- self.ftp.put('gsiftp://' + host + path + self.file_name)
+ self.url = 'gsiftp://' + host + path + self.file_name
+ self.tmp_url = 'gsiftp://' + host + path + self.file_name + '.part'
+
+ self.ftp.put(self.tmp_url)
StopFutureHandlers()
StopFutureHandlers()
@@
-36,6
+41,8
@@
class FtpUploadHandler(FileUploadHandler):
self.ftp.stream.put(None)
self.ftp.wait()
self.ftp.stream.put(None)
self.ftp.wait()
+ self.ftp.move(self.tmp_url, self.url)
+
return UploadedFile(name=self.file_name, size=file_size, charset=self.charset,
content_type=self.content_type, content_type_extra=self.content_type_extra)
return UploadedFile(name=self.file_name, size=file_size, charset=self.charset,
content_type=self.content_type, content_type_extra=self.content_type_extra)