]> git.ozlabs.org Git - patchwork/commit
models: Fix invalid dates in patch mbox
authorJeremy Kerr <jk@ozlabs.org>
Mon, 10 Jun 2013 02:16:24 +0000 (10:16 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Mon, 10 Jun 2013 02:16:24 +0000 (10:16 +0800)
commite7353352191516e45d21f9814375a92cc7f602dc
tree3c0aab82d62cba39084138674465af09634f7839
parent2f0eb64a6d543b26aa0a38ff1d5a09389a5b2f5c
models: Fix invalid dates in patch mbox

Currently, the Date header in mbox views is incorrect;
datetime.datetime.utctimetuple assumes that the date is in the local
timezone, but we keep all dates as UTC.

This change replaces utctimetuple with a manual calculation of the
seconds-since-epoch timestamp, which email.utils.formatdate requires. We
add a testcase for this too.

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
apps/patchwork/models.py
apps/patchwork/tests/mboxviews.py