[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/mail/delivery.py the log message broke the thread because fromaddr and toaddrs

Eckart Hertzler eckart at hertzler.de
Wed May 26 05:36:52 EDT 2004


Log message for revision 24985:
the log message broke the thread because fromaddr and toaddrs
where not defined in the scope.




-=-
Modified: Zope3/trunk/src/zope/app/mail/delivery.py
===================================================================
--- Zope3/trunk/src/zope/app/mail/delivery.py	2004-05-26 09:32:12 UTC (rev 24984)
+++ Zope3/trunk/src/zope/app/mail/delivery.py	2004-05-26 09:36:50 UTC (rev 24985)
@@ -167,6 +167,8 @@
 
         while True:
             for filename in self.maildir:
+                fromaddr = ''
+                toaddrs = ()
                 try:
                     file = open(filename)
                     message = file.read()
@@ -177,13 +179,17 @@
                     # XXX maybe log the Message-Id of the message sent
                     self.log.info("Mail from %s to %s sent.",
                                   fromaddr, ", ".join(toaddrs))
-                    # Blanket except because we don't want this thread to ever die
+                    # Blanket except because we don't want
+                    # this thread to ever die
                 except:
-                    # XXX maybe throw away erroring messages here?
-                    # XXX: Note that fromaddr and toaddr is not available
-                    #      here! This needs fixing. (SR)
-                    self.log.error("Error while sending mail from %s to %s.",
-                                   fromaddr, ", ".join(toaddrs), exc_info=1)
+                    if fromaddr != '' or toaddrs != ():
+                        self.log.error(
+                            "Error while sending mail from %s to %s.",
+                            fromaddr, ", ".join(toaddrs), exc_info=1)
+                    else:
+                        self.log.error(
+                            "Error while sending mail : %s ",
+                            filename, exc_info=1)
             else:
                 if forever:
                     self.__event.wait(3)




More information about the Zope3-Checkins mailing list