[Zope-CVS] CVS: Packages/SFTPGateway/src/sftpgateway -
connector.py:1.31
Fred L. Drake, Jr.
fred at zope.com
Mon Dec 22 10:46:02 EST 2003
Update of /cvs-repository/Packages/SFTPGateway/src/sftpgateway
In directory cvs.zope.org:/tmp/cvs-serv26628
Modified Files:
connector.py
Log Message:
separate the checkErrors() used for DeferredList from that use for a
simple Deferred
=== Packages/SFTPGateway/src/sftpgateway/connector.py 1.30 => 1.31 ===
--- Packages/SFTPGateway/src/sftpgateway/connector.py:1.30 Mon Dec 22 10:24:09 2003
+++ Packages/SFTPGateway/src/sftpgateway/connector.py Mon Dec 22 10:46:01 2003
@@ -102,8 +102,12 @@
d.addErrback(self.checkErrors, path)
return d
- def checkErrors(self, errors, path):
+ def checkErrorsDL(self, errors, path):
+ # errors.value for a DeferredList is a pair of (Failure, 0)
error = errors.value[0]
+ return self.checkErrors(error, path)
+
+ def checkErrors(self, error, path):
error.trap(ftp.CommandFailed)
errcode, errmsg = error.value.args[0][0].split(None, 1)
self._app.debug("error: %s %s", errcode, errmsg)
@@ -169,7 +173,7 @@
def _openDirectory(self, ftpClient, path):
protocol = DirectoryListProtocol(self, path)
d = ftpClient.list(path, protocol)
- d.addCallbacks(protocol.return_all, self.checkErrors,
+ d.addCallbacks(protocol.return_all, self.checkErrorsDL,
errbackArgs=(path,))
return d
@@ -187,14 +191,14 @@
if followLinks:
def callback1(value):
return protocol.return_one(value, base)
- d.addCallbacks(callback1, self.checkErrors, errbackArgs=(path,))
+ d.addCallbacks(callback1, self.checkErrorsDL, errbackArgs=(path,))
def callback2(value):
return self._getLinkedAttrs(value, ftpClient, path, dir)
d.addCallbacks(callback2, lambda x: x)
else:
def callback(value):
return protocol.return_one(None, base)[0]
- d.addCallbacks(callback, self.checkErrors, errbackArgs=(path,))
+ d.addCallbacks(callback, self.checkErrorsDL, errbackArgs=(path,))
return d
def _getLinkedAttrs(self, (attrs, target), ftpClient, path, dir):
@@ -231,7 +235,7 @@
return posixpath.join(dir, linktarget)
else:
raise OSError(errno.EINVAL, "not a symlink: %r" % path)
- d.addCallbacks(callback, self.checkErrors, errbackArgs=(path,))
+ d.addCallbacks(callback, self.checkErrorsDL, errbackArgs=(path,))
return d
# makeLink() does not map into the standard FTP protocol
@@ -529,7 +533,7 @@
def ebResponses(self, error):
if self._deferred is not None:
- error = self._connector.checkErrors(error, self._path)
+ error = self._connector.checkErrorsDL(error, self._path)
self._deferred.errback(error)
return error
More information about the Zope-CVS
mailing list