projects
/
living-lab-site.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
cis notified web server of a job completion; upload form interface and validation...
[living-lab-site.git]
/
cis
/
api
/
ftp.py
diff --git
a/cis/api/ftp.py
b/cis/api/ftp.py
index
567978f
..
3798fd3
100644
(file)
--- a/
cis/api/ftp.py
+++ b/
cis/api/ftp.py
@@
-11,7
+11,7
@@
import ftplib
import base
import ftp_config
import socket
import base
import ftp_config
import socket
-import
api
_exceptions
+import
cis
_exceptions
import os
import logger
import os
import logger
@@
-35,7
+35,7
@@
class FTPFileTransferer(base.BaseFileTransferer):
try:
self.ftp.cwd(self.remote_path)
except ftplib.error_perm as e:
try:
self.ftp.cwd(self.remote_path)
except ftplib.error_perm as e:
- raise
api
_exceptions.FileTransferException( \
+ raise
cis
_exceptions.FileTransferException( \
"Could not change remote directory '%s': %s" \
% (self.remote_path, repr(e)))
"Could not change remote directory '%s': %s" \
% (self.remote_path, repr(e)))
@@
-43,10
+43,15
@@
class FTPFileTransferer(base.BaseFileTransferer):
for crt_fn in files:
local_fn = os.path.join(self.local_path, crt_fn)
remote_fn = os.path.join(self.remote_path, crt_fn)
for crt_fn in files:
local_fn = os.path.join(self.local_path, crt_fn)
remote_fn = os.path.join(self.remote_path, crt_fn)
+
+ if os.path.exists(local_fn):
+ raise cis_exceptions.FileAlreadyExistsException( \
+ 'file "%s" already exists' % local_fn)
+
try:
file_local = open(local_fn, 'wb')
except IOError as e:
try:
file_local = open(local_fn, 'wb')
except IOError as e:
- raise
api
_exceptions.FileTransferException( \
+ raise
cis
_exceptions.FileTransferException( \
"Could not open local file '%s' for writing: %s" \
% (local_fn, repr(e)))
"Could not open local file '%s' for writing: %s" \
% (local_fn, repr(e)))
@@
-54,7
+59,7
@@
class FTPFileTransferer(base.BaseFileTransferer):
self.ftp.retrbinary('RETR %s' % crt_fn, file_local.write)
file_local.close()
except ftplib.error_perm as e:
self.ftp.retrbinary('RETR %s' % crt_fn, file_local.write)
file_local.close()
except ftplib.error_perm as e:
- raise
api
_exceptions.FileTransferException( \
+ raise
cis
_exceptions.FileTransferException( \
"Could not get file '%s' from Web Server: %s" \
% (remote_fn, repr(e)))
"Could not get file '%s' from Web Server: %s" \
% (remote_fn, repr(e)))
@@
-62,7
+67,7
@@
class FTPFileTransferer(base.BaseFileTransferer):
try:
self.ftp.cwd(self.remote_path)
except ftplib.error_perm as e:
try:
self.ftp.cwd(self.remote_path)
except ftplib.error_perm as e:
- raise
api
_exceptions.FileTransferException( \
+ raise
cis
_exceptions.FileTransferException( \
"Could not change remote directory '%s': %s" \
% (self.remote_path, repr(e)))
"Could not change remote directory '%s': %s" \
% (self.remote_path, repr(e)))
@@
-72,7
+77,7
@@
class FTPFileTransferer(base.BaseFileTransferer):
try:
file_local = open(local_fn, 'rb')
except IOError as e:
try:
file_local = open(local_fn, 'rb')
except IOError as e:
- raise
api
_exceptions.FileTransferException( \
+ raise
cis
_exceptions.FileTransferException( \
"Could not open local file '%s' for reading: %s" \
% (local_fn, repr(e)))
"Could not open local file '%s' for reading: %s" \
% (local_fn, repr(e)))
@@
-80,7
+85,7
@@
class FTPFileTransferer(base.BaseFileTransferer):
self.ftp.storbinary('STOR %s' % crt_fn, file_local)
file_local.close()
except ftplib.error_perm as e:
self.ftp.storbinary('STOR %s' % crt_fn, file_local)
file_local.close()
except ftplib.error_perm as e:
- raise
api
_exceptions.FileTransferException( \
+ raise
cis
_exceptions.FileTransferException( \
"Could not put file '%s' to Web Server: %s" \
% (local_fn, repr(e)))
"Could not put file '%s' to Web Server: %s" \
% (local_fn, repr(e)))