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

Doug Anderson dianders at chromium.org
Mon Nov 18 17:00:41 EST 2013

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 <wsa at the-dreams.de>
Signed-off-by: Doug Anderson <dianders at chromium.org>
 apps/patchwork/views/__init__.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/apps/patchwork/views/__init__.py b/apps/patchwork/views/__init__.py
index a823388..215aba9 100644
--- a/apps/patchwork/views/__init__.py
+++ b/apps/patchwork/views/__init__.py
@@ -195,7 +195,7 @@ def patch_to_mbox(patch):
     mail = PatchMbox(body)
     mail['Subject'] = patch.name
-    mail['From'] = email.utils.formataddr((
+    mail['X-Patchwork-Submitter'] = email.utils.formataddr((
                     str(Header(patch.submitter.name, mail.patch_charset)),
     mail['X-Patchwork-Id'] = str(patch.id)
@@ -203,7 +203,7 @@ def patch_to_mbox(patch):
     mail.set_unixfrom('From patchwork ' + patch.date.ctime())
-    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:

More information about the Patchwork mailing list