Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
4089c29e
Commit
4089c29e
authored
Aug 18, 2004
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Patch #791776: Replace SMTPHandler.date_time with email.Utils.formatdate.
parent
290d1360
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
16 deletions
+5
-16
Lib/logging/handlers.py
Lib/logging/handlers.py
+2
-16
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/logging/handlers.py
View file @
4089c29e
...
...
@@ -654,21 +654,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."""
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.
...
...
@@ -677,6 +662,7 @@ class SMTPHandler(logging.Handler):
"""
try
:
import
smtplib
from
email.Utils
import
formatdate
port
=
self
.
mailport
if
not
port
:
port
=
smtplib
.
SMTP_PORT
...
...
@@ -686,7 +672,7 @@ class SMTPHandler(logging.Handler):
self
.
fromaddr
,
string
.
join
(
self
.
toaddrs
,
","
),
self
.
getSubject
(
record
),
self
.
date_tim
e
(),
msg
)
formatdat
e
(),
msg
)
smtp
.
sendmail
(
self
.
fromaddr
,
self
.
toaddrs
,
msg
)
smtp
.
quit
()
except
:
...
...
Misc/NEWS
View file @
4089c29e
...
...
@@ -44,6 +44,9 @@ Extension modules
Library
-------
-
logging
.
handlers
.
SMTPHandler
.
date_time
has
been
removed
;
the
class
now
uses
email
.
Utils
.
formatdate
to
generate
the
time
stamp
.
-
A
new
function
tkFont
.
nametofont
was
added
to
return
an
existing
font
.
The
Font
class
constructor
now
has
an
additional
exists
argument
which
,
if
True
,
requests
to
return
/
configure
an
existing
font
,
rather
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment