import os
import re
from threading import Event
-from django.utils.http import urlunquote
+from django.utils.http import urlunquote
from django.utils.timezone import localtime, UTC
from gridftp import FTPClient, Buffer, HandleAttr, OperationAttr
class FTPError(Exception):
- pass
+ def __init__(self, message, verbose=None, *args, **kwargs):
+ super(FTPError, self).__init__(message, *args, **kwargs)
+
+ self.verbose = verbose
class FTPOperation:
self._end.clear()
if self._error is not None:
- # TODO logging
- print 'GridFTP ERROR:', self._error
-
match = re.search(r'A system call failed: (.*)$', self._error.replace('\r\n', '\n'), re.MULTILINE)
msg = match.groups()[0] if match else "Unknown error"
- raise FTPError(msg)
+ raise FTPError(msg, self._error)
def listing(self, url):
self.cli.verbose_list(url, self._done, None, self.op_attr)