comparison mercurial/mail.py @ 13244:d8f92c3a17d6

mail: fix regression when parsing unset smtp.tls option
author Patrick Mezard <pmezard@gmail.com>
date Fri, 07 Jan 2011 20:50:42 +0100
parents f05250572467
children 600e64004eb5
comparison
equal deleted inserted replaced
13243:159651b3c9ec 13244:d8f92c3a17d6
31 email.Header.Header.__dict__['__init__'] = _unifiedheaderinit 31 email.Header.Header.__dict__['__init__'] = _unifiedheaderinit
32 32
33 def _smtp(ui): 33 def _smtp(ui):
34 '''build an smtp connection and return a function to send mail''' 34 '''build an smtp connection and return a function to send mail'''
35 local_hostname = ui.config('smtp', 'local_hostname') 35 local_hostname = ui.config('smtp', 'local_hostname')
36 tls = ui.config('smtp', 'tls') 36 tls = ui.config('smtp', 'tls', 'none')
37 # backward compatible: when tls = true, we use starttls. 37 # backward compatible: when tls = true, we use starttls.
38 starttls = tls == 'starttls' or util.parsebool(tls) 38 starttls = tls == 'starttls' or util.parsebool(tls)
39 smtps = tls == 'smtps' 39 smtps = tls == 'smtps'
40 if (starttls or smtps) and not hasattr(socket, 'ssl'): 40 if (starttls or smtps) and not hasattr(socket, 'ssl'):
41 raise util.Abort(_("can't use TLS: Python SSL support not installed")) 41 raise util.Abort(_("can't use TLS: Python SSL support not installed"))