cwconfig.py
branchstable
changeset 5198 cf8292f80384
parent 5143 43afbdd5c8b4
child 5201 2b4267157f85
child 5264 57ac406d1d82
--- a/cwconfig.py	Fri Apr 09 12:23:39 2010 +0200
+++ b/cwconfig.py	Fri Apr 09 15:04:56 2010 +0200
@@ -1019,7 +1019,9 @@
         return i18n.compile_i18n_catalogs(sourcedirs, i18ndir, langs)
 
     def sendmails(self, msgs):
-        """msgs: list of 2-uple (message object, recipients)"""
+        """msgs: list of 2-uple (message object, recipients). Return False
+        if connection to the smtp server failed, else True.
+        """
         server, port = self['smtp-host'], self['smtp-port']
         SMTP_LOCK.acquire()
         try:
@@ -1028,7 +1030,7 @@
             except Exception, ex:
                 self.exception("can't connect to smtp server %s:%s (%s)",
                                server, port, ex)
-                return
+                return False
             heloaddr = '%s <%s>' % (self['sender-name'], self['sender-addr'])
             for msg, recipients in msgs:
                 try:
@@ -1039,6 +1041,7 @@
             smtp.close()
         finally:
             SMTP_LOCK.release()
+        return True
 
 set_log_methods(CubicWebConfiguration, logging.getLogger('cubicweb.configuration'))