summaryrefslogtreecommitdiffstats
path: root/apps/patchwork
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2008-10-10 18:08:08 +1100
committerJeremy Kerr <jk@ozlabs.org>2008-10-10 18:08:08 +1100
commit406d17e8df324c235172ed673ef65e998ca1f6a4 (patch)
treebf19eb47e819106df0279273f7a5e80eca71cafe /apps/patchwork
parentab0062c77d1fd7d1ed583d3db6528a06bface822 (diff)
downloadpatchwork-406d17e8df324c235172ed673ef65e998ca1f6a4.tar.bz2
patchwork-406d17e8df324c235172ed673ef65e998ca1f6a4.tar.xz
[parser] Accept x-diff patches
We should accept x-diff attachments as well as x-patch. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'apps/patchwork')
-rwxr-xr-xapps/patchwork/bin/parsemail.py5
-rw-r--r--apps/patchwork/tests/patchparser.py6
2 files changed, 8 insertions, 3 deletions
diff --git a/apps/patchwork/bin/parsemail.py b/apps/patchwork/bin/parsemail.py
index 2acceb5..d73343a 100755
--- a/apps/patchwork/bin/parsemail.py
+++ b/apps/patchwork/bin/parsemail.py
@@ -138,11 +138,12 @@ def find_content(project, mail):
continue
payload = part.get_payload(decode=True)
+ subtype = part.get_content_subtype()
- if part.get_content_subtype() == 'x-patch':
+ if subtype in ['x-patch', 'x-diff']:
patchbuf = payload
- if part.get_content_subtype() == 'plain':
+ elif subtype == 'plain':
if not patchbuf:
(patchbuf, c) = parse_patch(payload)
else:
diff --git a/apps/patchwork/tests/patchparser.py b/apps/patchwork/tests/patchparser.py
index be569c7..e508dc0 100644
--- a/apps/patchwork/tests/patchparser.py
+++ b/apps/patchwork/tests/patchparser.py
@@ -61,14 +61,18 @@ class InlinePatchTest(PatchTest):
class AttachmentPatchTest(InlinePatchTest):
patch_filename = '0001-add-line.patch'
test_comment = 'Test for attached patch'
+ content_subtype = 'x-patch'
def setUp(self):
self.orig_patch = read_patch(self.patch_filename)
email = create_email(self.test_comment, multipart = True)
- attachment = MIMEText(self.orig_patch, _subtype = 'x-patch')
+ attachment = MIMEText(self.orig_patch, _subtype = self.content_subtype)
email.attach(attachment)
(self.patch, self.comment) = find_content(self.project, email)
+class AttachmentXDiffPatchTest(AttachmentPatchTest):
+ content_subtype = 'x-diff'
+
class UTF8InlinePatchTest(InlinePatchTest):
patch_filename = '0002-utf-8.patch'
patch_encoding = 'utf-8'