summaryrefslogtreecommitdiffstats
path: root/apps/patchwork/views
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2013-06-10 11:50:21 +0800
committerJeremy Kerr <jk@ozlabs.org>2013-06-10 12:00:45 +0800
commit4e0db9ebf1279afc0f2a187f25dbfcb97e314a78 (patch)
treecd7f1a3d5bfbac2df4ce51558f7a8feea10feab0 /apps/patchwork/views
parent67181f5c929018d5304732969f0811795c13ea37 (diff)
downloadpatchwork-4e0db9ebf1279afc0f2a187f25dbfcb97e314a78.tar.bz2
patchwork-4e0db9ebf1279afc0f2a187f25dbfcb97e314a78.tar.xz
views/mbox: Use Date: header from original message
Since we use UTC for internal date storage, we lose the timestamp info from the original patch submissions. This means that the mbox views (which are typically passed through to SCM commit logs) lose the timezone information. This change uses the Date header from the original message, if possible. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'apps/patchwork/views')
-rw-r--r--apps/patchwork/views/__init__.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/apps/patchwork/views/__init__.py b/apps/patchwork/views/__init__.py
index cb35c1f..681532a 100644
--- a/apps/patchwork/views/__init__.py
+++ b/apps/patchwork/views/__init__.py
@@ -195,7 +195,6 @@ def patch_to_mbox(patch):
mail = PatchMbox(body)
mail['Subject'] = patch.name
- mail['Date'] = email.utils.formatdate(utc_timestamp)
mail['From'] = email.utils.formataddr((
str(Header(patch.submitter.name, mail.patch_charset)),
patch.submitter.email))
@@ -204,10 +203,13 @@ def patch_to_mbox(patch):
mail.set_unixfrom('From patchwork ' + patch.date.ctime())
- copied_headers = ['To', 'Cc']
+ copied_headers = ['To', 'Cc', 'Date']
orig_headers = HeaderParser().parsestr(str(patch.headers))
for header in copied_headers:
if header in orig_headers:
mail[header] = orig_headers[header]
+ if 'Date' not in mail:
+ mail['Date'] = email.utils.formatdate(utc_timestamp)
+
return mail