]> git.ozlabs.org Git - patchwork/blobdiff - apps/patchwork/bin/parsemail.py
parsemail.sh typo: Insert missing slash in path
[patchwork] / apps / patchwork / bin / parsemail.py
index d0993acfc2f641a790c08f35917cbb669111351b..8e73c258fce90e9354bf16275a0427e2be791dca 100755 (executable)
@@ -25,8 +25,13 @@ import datetime
 import time
 import operator
 from email import message_from_file
-from email.header import Header
-from email.utils import parsedate_tz, mktime_tz
+try:
+    from email.header import Header
+    from email.utils import parsedate_tz, mktime_tz
+except ImportError:
+    # Python 2.4 compatibility
+    from email.Header import Header
+    from email.Utils import parsedate_tz, mktime_tz
 
 from patchparser import parse_patch
 from patchwork.models import Patch, Project, Person, Comment
@@ -150,8 +155,8 @@ def find_content(project, mail):
 
     if commentbuf:
         if patch:
-           cpatch = patch
-       else:
+            cpatch = patch
+        else:
             cpatch = find_patch_for_comment(mail)
             if not cpatch:
                 return (None, None)
@@ -248,7 +253,7 @@ def main(args):
         try:
             patch.save()
         except Exception, ex:
-            print ex.message
+            print str(ex)
 
     if comment:
         if save_required:
@@ -262,7 +267,7 @@ def main(args):
         try:
             comment.save()
         except Exception, ex:
-            print ex.message
+            print str(ex)
 
     return 0