changeset 4093:669f99f78db0

mail.py: don't try to use TLS if python doesn't have SSL support This should hide the traceback from issue501.
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Fri, 16 Feb 2007 04:54:47 -0200
parents 4ced663bebf0
children fbf0e9acfd83
files mercurial/mail.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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()