[PATCH] parsemail: Ignore multiple cover letters

Russell Currey ruscur at russell.cc
Fri Jul 15 16:29:10 AEST 2016


If multiple cover letters are found, parsemail dies with a
MultipleObjectsReturned exception.  This is particularly problematic in
the middle of a parsearchive run, so just ignore multiple cover letters.

Signed-off-by: Russell Currey <ruscur at russell.cc>
---
 patchwork/bin/parsemail.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/patchwork/bin/parsemail.py b/patchwork/bin/parsemail.py
index 8648d29..48f809f 100755
--- a/patchwork/bin/parsemail.py
+++ b/patchwork/bin/parsemail.py
@@ -523,6 +523,9 @@ def parse_mail(mail, list_id=None):
                 CoverLetter.objects.all().get(name=name)
             except CoverLetter.DoesNotExist:  # no match => new cover
                 is_cover_letter = True
+            except CoverLetter.MultipleObjectsReturned:
+                # if multiple cover letters are found, just ignore
+                pass
         else:
             is_cover_letter = True
 
-- 
2.9.0



More information about the Patchwork mailing list