[PATCH 08/10] views: make X-Patchwork-Delegate: to work again

Mauro Carvalho Chehab mchehab at osg.samsung.com
Sat Nov 28 23:14:44 AEDT 2015


Something broke the output of X-Patchwork-Delegate: via xmlrpc.

Fix it by moving the code to the xmlrpc part.

Signed-off-by: Mauro Carvalho Chehab <mchehab at osg.samsung.com>
---
 patchwork/models.py         | 2 --
 patchwork/views/__init__.py | 4 ++++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/patchwork/models.py b/patchwork/models.py
index 024ff4d8d5e1..676422d8aae5 100644
--- a/patchwork/models.py
+++ b/patchwork/models.py
@@ -363,8 +363,6 @@ class Patch(models.Model):
                         time.mktime(self.date.utctimetuple()))
         mail['From'] = unicode(self.submitter)
         mail['X-Patchwork-Id'] = str(self.id)
-	if self.delegate:
-            mail['X-Patchwork-Delegate'] = str(self.delegate.email)
         mail['Message-Id'] = self.msgid
         mail.set_unixfrom('From patchwork ' + self.date.ctime())
 
diff --git a/patchwork/views/__init__.py b/patchwork/views/__init__.py
index 8df8920ce991..20122b733c3c 100644
--- a/patchwork/views/__init__.py
+++ b/patchwork/views/__init__.py
@@ -205,6 +205,10 @@ def patch_to_mbox(patch):
     mail['Message-Id'] = patch.msgid
     mail.set_unixfrom('From patchwork ' + patch.date.ctime())
 
+    try:
+        mail['X-Patchwork-Delegate'] = str(patch.delegate.email)
+    except:
+	pass
 
     copied_headers = ['To', 'Cc', 'Date']
     orig_headers = HeaderParser().parsestr(str(patch.headers))
-- 
2.5.0



More information about the Patchwork mailing list