summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlav Vitters <ovitters@mageia.org>2012-03-11 13:15:23 +0000
committerOlav Vitters <ovitters@mageia.org>2012-03-11 13:15:23 +0000
commit7e545849b96b40a6854433d6ad69af0b75df269a (patch)
tree84819e79a04afbbd3a5de31f831df38a30ce67fb
parent291c0c098e13211b62fc210453cbcf156ed4e1e8 (diff)
downloadmgagnome-7e545849b96b40a6854433d6ad69af0b75df269a.tar
mgagnome-7e545849b96b40a6854433d6ad69af0b75df269a.tar.gz
mgagnome-7e545849b96b40a6854433d6ad69af0b75df269a.tar.bz2
mgagnome-7e545849b96b40a6854433d6ad69af0b75df269a.tar.xz
mgagnome-7e545849b96b40a6854433d6ad69af0b75df269a.zip
put better error message in subject line
-rwxr-xr-xmgagnome11
1 files changed, 10 insertions, 1 deletions
diff --git a/mgagnome b/mgagnome
index 4aad343..a0f5f32 100755
--- a/mgagnome
+++ b/mgagnome
@@ -628,7 +628,16 @@ def cmd_parse_ftp_release_list(options, parser):
"""Send an reply email"""
contents.seek(0)
msg = MIMEText(contents.read(), _charset='utf-8')
- msg['Subject'] = "Re: %s%s" % (orig_msg['Subject'], " (ERROR)" if error else "")
+ if error:
+ # XXX - ugly
+ contents.seek(0)
+ lastline = contents.read().splitlines()[-1]
+ # Remove things like "ERROR: " and so on from the last line
+ lastline = re.sub(r'^(?:[^ :]+:\s+)+', '', lastline)
+ subjecterrror = " (ERROR: %s)" % lastline if lastline else " (ERROR)"
+ else:
+ subjecterror = ""
+ msg['Subject'] = "Re: %s%s" (orig_msg['Subject'], subjecterror)
msg['To'] = to
msg["In-Reply-To"] = orig_msg["Message-ID"]
msg["References"] = orig_msg["Message-ID"]