diff options
author | Heikki Toivonen <heikki@heikkitoivonen.net> | 2009-06-18 03:49:40 +0000 |
---|---|---|
committer | Heikki Toivonen <heikki@heikkitoivonen.net> | 2009-06-18 03:49:40 +0000 |
commit | 68f0ffa06e271fb37b3181a99665046e2e577838 (patch) | |
tree | 64d719393f5e1b59a96c93077c978c86b1eeb9ea | |
parent | 870c3c5705b5514f9196d7b71ec612c57f7cec3d (diff) | |
download | m2crypto-68f0ffa06e271fb37b3181a99665046e2e577838.tar.gz |
Bug 12840, ftpslib now works with Python 2.6, patch by Theodore A. Roth.
git-svn-id: http://svn.osafoundation.org/m2crypto/trunk@683 2715db39-9adf-0310-9c64-84f055769b4b
-rw-r--r-- | CHANGES | 1 | ||||
-rw-r--r-- | M2Crypto/ftpslib.py | 3 | ||||
-rw-r--r-- | tests/test_ssl.py | 8 |
3 files changed, 10 insertions, 2 deletions
@@ -17,6 +17,7 @@ - SSLServer.__init__ now takes optional bind_and_activate parameter and initializes by calling SocketServer.BaseServer.__init__, which are Python 2.6 compatibility fixes, by Christian +- ftpslib now works with Python 2.6, by Theodore A. Roth - Reverted a change done in 0.17 to m2urllib2 which changed urls to include host when it should stay as it was - SMIME.text_crlf and text_crlf_bio were always raising TypeError; fixed diff --git a/M2Crypto/ftpslib.py b/M2Crypto/ftpslib.py index 97724aa..b7d82fd 100644 --- a/M2Crypto/ftpslib.py +++ b/M2Crypto/ftpslib.py @@ -52,8 +52,7 @@ class FTP_TLS(FTP): self.ssl_ctx = ssl_ctx else: self.ssl_ctx = SSL.Context(DEFAULT_PROTOCOL) - if host: - self.connect(host) + FTP.__init__(self, host) self.prot = 0 def auth_tls(self): diff --git a/tests/test_ssl.py b/tests/test_ssl.py index d74dfe0..658e8a6 100644 --- a/tests/test_ssl.py +++ b/tests/test_ssl.py @@ -1062,6 +1062,13 @@ class SessionTestCase(unittest.TestCase): self.assertRaises(SSL.SSLError, SSL.Session.load_session, 'tests/signer.pem') +class FtpslibTestCase(unittest.TestCase): + def test_26_compat(self): + from M2Crypto import ftpslib + f = ftpslib.FTP_TLS() + # 2.6 used to raise AttributeError: + self.assertRaises(socket.gaierror, f.connect, 'no-such-host-dfgHJK56789', 990) + def suite(): suite = unittest.TestSuite() @@ -1075,6 +1082,7 @@ def suite(): suite.addTest(unittest.makeSuite(UrllibSSLClientTestCase)) suite.addTest(unittest.makeSuite(Urllib2SSLClientTestCase)) suite.addTest(unittest.makeSuite(MiscSSLClientTestCase)) + suite.addTest(unittest.makeSuite(FtpslibTestCase)) try: import M2Crypto.SSL.TwistedProtocolWrapper as wrapper suite.addTest(unittest.makeSuite(TwistedSSLClientTestCase)) |