rfc822 date header
Lars Wirzenius
liw at iki.fi
Sun Apr 25 02:53:11 EDT 1999
Lars Wirzenius <liw at iki.fi>:
> Here's what I wrote for Slime (thhe mailer I'm writing):
How embarrassing, the code I posted doesn't work. I'm pretty sure it
did work, at some point in time, but either I misremember, or I broke
it, or the stuff within rfc822 I use changed. Never mind, here is the
new version:
def _date_header(self):
"""Return Date header reflecting current time."""
# XXX this should probably communicate the local time zone
# somehow
t = time.gmtime(time.time())
return "Date: %s, %02d %s %04d %02d:%02d:%02d GMT\n" % \
(string.capitalize(rfc822._daynames[t[6]]),
t[2],
string.capitalize(rfc822._monthnames[t[1] - 1]),
t[0],
t[3],
t[4],
t[5])
More information about the Python-list
mailing list