[Python-checkins] python/dist/src/Lib/logging handlers.py, 1.16, 1.17

loewis at users.sourceforge.net loewis at users.sourceforge.net
Wed Aug 18 14:27:43 CEST 2004


Update of /cvsroot/python/python/dist/src/Lib/logging
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27372/Lib/logging

Modified Files:
	handlers.py 
Log Message:
Patch #791776: Replace SMTPHandler.date_time with email.Utils.formatdate.


Index: handlers.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/logging/handlers.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** handlers.py	12 Jul 2004 09:21:41 -0000	1.16
--- handlers.py	18 Aug 2004 12:27:40 -0000	1.17
***************
*** 655,673 ****
          return self.subject
  
-     weekdayname = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
- 
-     monthname = [None,
-                  'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
-                  'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
- 
-     def date_time(self):
-         """Return the current date and time formatted for a MIME header."""
-         year, month, day, hh, mm, ss, wd, y, z = time.gmtime(time.time())
-         s = "%s, %02d %3s %4d %02d:%02d:%02d GMT" % (
-                 self.weekdayname[wd],
-                 day, self.monthname[month], year,
-                 hh, mm, ss)
-         return s
- 
      def emit(self, record):
          """
--- 655,658 ----
***************
*** 678,681 ****
--- 663,667 ----
          try:
              import smtplib
+             from email.Utils import formatdate
              port = self.mailport
              if not port:
***************
*** 687,691 ****
                              string.join(self.toaddrs, ","),
                              self.getSubject(record),
!                             self.date_time(), msg)
              smtp.sendmail(self.fromaddr, self.toaddrs, msg)
              smtp.quit()
--- 673,677 ----
                              string.join(self.toaddrs, ","),
                              self.getSubject(record),
!                             formatdate(), msg)
              smtp.sendmail(self.fromaddr, self.toaddrs, msg)
              smtp.quit()



More information about the Python-checkins mailing list