]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
parsemail: Fix return value for find_content error case
authorJeremy Kerr <jk@ozlabs.org>
Mon, 28 Mar 2016 03:31:38 +0000 (11:31 +0800)
committerStephen Finucane <stephen.finucane@intel.com>
Tue, 29 Mar 2016 08:57:16 +0000 (09:57 +0100)
If we fail to decode a message payload, we'll fail with the following:

  Traceback (most recent call last):
    File "./patchwork/bin/parsemail.py", line 563, in <module>
      sys.exit(main(sys.argv))
    File "./patchwork/bin/parsemail.py", line 553, in main
      return parse_mail(mail, args['list_id'])
    File "./patchwork/bin/parsemail.py", line 464, in parse_mail
      (patch, comment, filenames) = find_content(project, mail)
  ValueError: need more than 2 values to unpack

- as the error condition for find_content only returns a 2-tuple. This
change fixes the error case to the 3-tuple return type.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Acked-by: Stephen Finucane <stephen.finucane@intel.com>
patchwork/bin/parsemail.py

index 7a9e00916fe0bcb34c1d6dcdb6150c7567d0aefc..dcb4fe00c0814d51b0bbdaa00679e61f6b7abd34 100755 (executable)
@@ -231,7 +231,7 @@ def find_content(project, mail):
 
             # Could not find a valid decoded payload.  Fail.
             if payload is None:
-                return (None, None)
+                return (None, None, None)
 
         if subtype in ['x-patch', 'x-diff']:
             patchbuf = payload