mail.py: don't try to use TLS if python doesn't have SSL support
This should hide the traceback from issue501.
--- a/mercurial/mail.py Fri Feb 16 04:54:46 2007 -0200
+++ b/mercurial/mail.py Fri Feb 16 04:54:47 2007 -0200
@@ -7,7 +7,7 @@
from i18n import gettext as _
from demandload import *
-demandload(globals(), "os re smtplib templater util")
+demandload(globals(), "os re smtplib templater util socket")
def _smtp(ui):
'''send mail using smtp.'''
@@ -22,6 +22,9 @@
(mailhost, mailport))
s.connect(host=mailhost, port=mailport)
if ui.configbool('smtp', 'tls'):
+ if not hasattr(socket, 'ssl'):
+ raise util.Abort(_("can't use TLS: Python SSL support "
+ "not installed"))
ui.note(_('(using tls)\n'))
s.ehlo()
s.starttls()