##// END OF EJS Templates
mail: drop python 2.5 support
timeless@mozdev.org -
r26673:ab1af5e7 default
parent child Browse files
Show More
@@ -70,31 +70,27 b' class STARTTLS(smtplib.SMTP):'
70 self.does_esmtp = 0
70 self.does_esmtp = 0
71 return (resp, reply)
71 return (resp, reply)
72
72
73 if util.safehasattr(smtplib.SMTP, '_get_socket'):
73 class SMTPS(smtplib.SMTP):
74 class SMTPS(smtplib.SMTP):
74 '''Derived class to verify the peer certificate for SMTPS.
75 '''Derived class to verify the peer certificate for SMTPS.
76
77 This class allows to pass any keyword arguments to SSL socket creation.
78 '''
79 def __init__(self, sslkwargs, keyfile=None, certfile=None, **kwargs):
80 self.keyfile = keyfile
81 self.certfile = certfile
82 smtplib.SMTP.__init__(self, **kwargs)
83 self.default_port = smtplib.SMTP_SSL_PORT
84 self._sslkwargs = sslkwargs
85
75
86 def _get_socket(self, host, port, timeout):
76 This class allows to pass any keyword arguments to SSL socket creation.
87 if self.debuglevel > 0:
77 '''
88 print >> sys.stderr, 'connect:', (host, port)
78 def __init__(self, sslkwargs, keyfile=None, certfile=None, **kwargs):
89 new_socket = socket.create_connection((host, port), timeout)
79 self.keyfile = keyfile
90 new_socket = sslutil.wrapsocket(new_socket,
80 self.certfile = certfile
91 self.keyfile, self.certfile,
81 smtplib.SMTP.__init__(self, **kwargs)
92 **self._sslkwargs)
82 self.default_port = smtplib.SMTP_SSL_PORT
93 self.file = smtplib.SSLFakeFile(new_socket)
83 self._sslkwargs = sslkwargs
94 return new_socket
84
95 else:
85 def _get_socket(self, host, port, timeout):
96 def SMTPS(sslkwargs, keyfile=None, certfile=None, **kwargs):
86 if self.debuglevel > 0:
97 raise error.Abort(_('SMTPS requires Python 2.6 or later'))
87 print >> sys.stderr, 'connect:', (host, port)
88 new_socket = socket.create_connection((host, port), timeout)
89 new_socket = sslutil.wrapsocket(new_socket,
90 self.keyfile, self.certfile,
91 **self._sslkwargs)
92 self.file = smtplib.SSLFakeFile(new_socket)
93 return new_socket
98
94
99 def _smtp(ui):
95 def _smtp(ui):
100 '''build an smtp connection and return a function to send mail'''
96 '''build an smtp connection and return a function to send mail'''
General Comments 0
You need to be logged in to leave comments. Login now