Patchwork [v2,4/5] models: Don't munge the 'From' field of patches

mail settings
Submitter Doug Anderson
Date Nov. 18, 2013, 6 a.m.
Message ID <>
Download mbox | patch
Permalink /patch/291945/
State Under Review
Delegated to: Stephen Finucane
Headers show


Doug Anderson - Nov. 18, 2013, 6 a.m.
At the moment patchwork always uses the official submitter name (as
patchwork understands it) as the "From" for patches that you receive.
This isn't quite what users expect and has some unfortunate

The biggest problem is that patchwork saves the "official" name for an
email address the first time it sees an email from them.  If that name
is wrong (or was missing) patchwork will be confused even if future
emails from this person are fixed.  There are similar problems if a
user changes his/her name (get married?).

It seems better to just have each patch report the actual "From" that
was used to send that patch.  We'll still return the submitter in
'X-Patchwork-Submitter' just in case someone wants it.

Reported-by: Wolfram Sang <>
Signed-off-by: Doug Anderson <>
 apps/patchwork/views/ | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)


diff --git a/apps/patchwork/views/ b/apps/patchwork/views/
index a823388..215aba9 100644
--- a/apps/patchwork/views/
+++ b/apps/patchwork/views/
@@ -195,7 +195,7 @@  def patch_to_mbox(patch):
     mail = PatchMbox(body)
     mail['Subject'] =
-    mail['From'] = email.utils.formataddr((
+    mail['X-Patchwork-Submitter'] = email.utils.formataddr((
                     str(Header(, mail.patch_charset)),
     mail['X-Patchwork-Id'] = str(
@@ -203,7 +203,7 @@  def patch_to_mbox(patch):
     mail.set_unixfrom('From patchwork ' +
-    copied_headers = ['To', 'Cc', 'Date']
+    copied_headers = ['To', 'Cc', 'Date', 'From']
     orig_headers = HeaderParser().parsestr(str(patch.headers))
     for header in copied_headers:
         if header in orig_headers: