]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/utils/mail.py
just pass AttributeError exceptions because their is a chance that a None object...
[osqa.git] / forum / utils / mail.py
index 8016b0034701deb5f5faf3d3d3c9f866adf57a39..84a79b35a876297fd0e0e9c5bff6ac605074378c 100644 (file)
@@ -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()
                 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()
                     connection = None
 
         try:
             connection.quit()
+        except AttributeError:
+            pass
         except socket.sslerror:
             connection.close()
     except Exception, e:
         except socket.sslerror:
             connection.close()
     except Exception, e: