From: Michael Brown Date: Fri, 25 Apr 2014 06:18:54 +0000 (-0400) Subject: Check before using ssl.create_default_context X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=839f02662e138ed3cbfa6f155a8b79eaeac696e5;p=discourse_docker.git Check before using ssl.create_default_context --- diff --git a/scripts/mailtest b/scripts/mailtest index 9403ff2..e6d1595 100755 --- a/scripts/mailtest +++ b/scripts/mailtest @@ -36,6 +36,10 @@ def do_tls(conn, sslv): # Possible values of smtp_sslv: none|peer|client_once|fail_if_no_peer_cert try: # Creating a context with the purpose of server authentication implies verifying the certificate + if not hasattr(ssl,'create_default_context'): + # ssl.create_default_context is in Pyton 3.4+ + print_warn('WARNING: cannot verify server certificate') + return conn.starttls() sslcontext=ssl.create_default_context(purpose=ssl.Purpose.SERVER_AUTH) # The None below looks like might be a typo but it's not - it represents the ActiveRecord default (to verify) if sslv in (None, 'peer', 'client_once', 'fail_if_no_peer_cert'):