From: jordan Date: Mon, 26 Sep 2011 20:53:28 +0000 (+0000) Subject: just pass AttributeError exceptions because their is a chance that a None object... X-Git-Tag: live~139 X-Git-Url: https://git.openstreetmap.org./osqa.git/commitdiff_plain/5bb61195fdad5c52937725e834e3cd0e9eacb5fa?hp=e1be4a899f22eda7988a0aeb3ee70cbba0fba657 just pass AttributeError exceptions because their is a chance that a None object has already been assigned to the connection instance and log all other email errors git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@1178 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- diff --git a/forum/utils/mail.py b/forum/utils/mail.py index 8016b00..84a79b3 100644 --- a/forum/utils/mail.py +++ b/forum/utils/mail.py @@ -94,12 +94,15 @@ def create_and_send_mail_messages(messages): logging.error("Couldn't send mail using the sendmail method: %s" % e) try: connection.quit() - connection = None - except Exception: + except Exception, e: + logging.error(e) + finally: connection = None try: connection.quit() + except AttributeError: + pass except socket.sslerror: connection.close() except Exception, e: