Message146554
turns out timetuple was not passing timezone information. the correct way of converting a datetime.datetime object to a correct rfc-2822 compliant date string seems to be:
email.utils.formatdate(time.mktime(a.utctimetuple()) + 1e-6 * a.microsecond - time.timezone)
what a mess. if the above is indeed the right way to do this, is it possible to add the following function to the email.utils module?
def formatdatetime(dt_object):
return email.utils.formatdate(time.mktime(dt_object.utctimetuple()) + 1e-6 * a.microsecond - time.timezone)
this works for datetime instances both with and without time zone information.
ps: i updated the code in the github link but not here. |
|
| Date |
User |
Action |
Args |
| 2011-10-28 12:06:35 | burak.arslan | set | recipients:
+ burak.arslan |
| 2011-10-28 12:06:35 | burak.arslan | set | messageid: <[email protected]> |
| 2011-10-28 12:06:34 | burak.arslan | link | issue13284 messages |
| 2011-10-28 12:06:34 | burak.arslan | create | |
|