diff mbox

[2/6] xmlrpc: include UNIX mbox 'From ' header in patch_get_mbox()

Message ID 1416717526-22221-2-git-send-email-computersforpeace@gmail.com
State Accepted
Headers show

Commit Message

Brian Norris Nov. 23, 2014, 4:38 a.m. UTC
This function is misleadingly named 'mbox'; the contents do not begin
with a proper 'From xxx <date>' separator line. (Notably, the mbox
format does not have an authoritative standard, but at least this basic
'separator' construct is noted in http://tools.ietf.org/html/rfc4155.)

The Message.as_string() function takes an optional [unixfrom] boolean
argument. Let's use it, like we do everywhere else (including in the web
interface 'mbox' link).

Among other things, this means that we can straightforwardly concatenate
the output of patch_get_mbox(), and more tools can use this output
as-is.

Example header:

From patchwork Fri Nov 21 18:24:29 2014
...

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
 apps/patchwork/views/xmlrpc.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/apps/patchwork/views/xmlrpc.py b/apps/patchwork/views/xmlrpc.py
index 6a561d34742c..b41ba0d2338d 100644
--- a/apps/patchwork/views/xmlrpc.py
+++ b/apps/patchwork/views/xmlrpc.py
@@ -378,7 +378,7 @@  def patch_get_mbox(patch_id):
     """Return mbox string for the given patch ID."""
     try:
         patch = Patch.objects.filter(id = patch_id)[0]
-        return patch_to_mbox(patch).as_string()
+        return patch_to_mbox(patch).as_string(True)
     except:
         return ""