Kaydet (Commit) 7ce5c831 authored tarafından Vinay Sajip's avatar Vinay Sajip

logging: Removed some more 1.5.2 support code.

üst 4dcba975
# Copyright 2001-2009 by Vinay Sajip. All Rights Reserved. # Copyright 2001-2010 by Vinay Sajip. All Rights Reserved.
# #
# Permission to use, copy, modify, and distribute this software and its # Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted, # documentation for any purpose and without fee is hereby granted,
...@@ -19,7 +19,7 @@ Additional handlers for the logging package for Python. The core package is ...@@ -19,7 +19,7 @@ Additional handlers for the logging package for Python. The core package is
based on PEP 282 and comments thereto in comp.lang.python, and influenced by based on PEP 282 and comments thereto in comp.lang.python, and influenced by
Apache's log4j system. Apache's log4j system.
Copyright (C) 2001-2009 Vinay Sajip. All Rights Reserved. Copyright (C) 2001-2010 Vinay Sajip. All Rights Reserved.
To use, simply 'import logging.handlers' and log away! To use, simply 'import logging.handlers' and log away!
""" """
...@@ -850,24 +850,6 @@ class SMTPHandler(logging.Handler): ...@@ -850,24 +850,6 @@ class SMTPHandler(logging.Handler):
""" """
return self.subject 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.
Needed for Python 1.5.2 (no email package available)
"""
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): def emit(self, record):
""" """
Emit a record. Emit a record.
...@@ -876,10 +858,7 @@ class SMTPHandler(logging.Handler): ...@@ -876,10 +858,7 @@ class SMTPHandler(logging.Handler):
""" """
try: try:
import smtplib import smtplib
try:
from email.utils import formatdate from email.utils import formatdate
except ImportError:
formatdate = self.date_time
port = self.mailport port = self.mailport
if not port: if not port:
port = smtplib.SMTP_PORT port = smtplib.SMTP_PORT
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment