logging: Removed some more 1.5.2 support code.
This commit is contained in:
parent
4dcba97590
commit
7ce5c831cc
|
@ -1,4 +1,4 @@
|
|||
# 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
|
||||
# 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
|
|||
based on PEP 282 and comments thereto in comp.lang.python, and influenced by
|
||||
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!
|
||||
"""
|
||||
|
@ -850,24 +850,6 @@ class SMTPHandler(logging.Handler):
|
|||
"""
|
||||
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):
|
||||
"""
|
||||
Emit a record.
|
||||
|
@ -876,10 +858,7 @@ class SMTPHandler(logging.Handler):
|
|||
"""
|
||||
try:
|
||||
import smtplib
|
||||
try:
|
||||
from email.utils import formatdate
|
||||
except ImportError:
|
||||
formatdate = self.date_time
|
||||
from email.utils import formatdate
|
||||
port = self.mailport
|
||||
if not port:
|
||||
port = smtplib.SMTP_PORT
|
||||
|
|
Loading…
Reference in New Issue