diff options
| author | Brian Dolbec <brian.dolbec@gmail.com> | 2011-02-10 21:54:34 -0800 |
|---|---|---|
| committer | Brian Dolbec <brian.dolbec@gmail.com> | 2011-02-10 21:54:34 -0800 |
| commit | 10ae0f76a9aa56c467f0a9afc187411149444bf5 (patch) | |
| tree | c1ce9853994fd8e5745e35ae54c647176bec1465 /bin | |
| parent | 768096f120ac1aec161416e284eeec97ef376b3d (diff) | |
| parent | abbbe4535a9b5f5264b22379425b17a8c261e7af (diff) | |
| download | gentoolkit-10ae0f76a9aa56c467f0a9afc187411149444bf5.tar.gz | |
Merge branch 'gentoolkit' of git+ssh://git.overlays.gentoo.org/proj/gentoolkit into gentoolkit
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/glsa-check | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/bin/glsa-check b/bin/glsa-check index a8c0188..a35375b 100755 --- a/bin/glsa-check +++ b/bin/glsa-check @@ -358,7 +358,7 @@ if mode == "mail": import portage_mail import socket - from io import StringIO + from io import BytesIO try: from email.mime.text import MIMEText except ImportError: @@ -380,11 +380,13 @@ if mode == "mail": mysubject = "[glsa-check] Summary for %s" % socket.getfqdn() # need a file object for summarylist() - myfd = StringIO() - myfd.write("GLSA Summary report for host %s\n" % socket.getfqdn()) - myfd.write("(Command was: %s)\n\n" % " ".join(sys.argv)) + myfd = BytesIO() + line = "GLSA Summary report for host %s\n" % socket.getfqdn() + myfd.write(line.encode("utf-8")) + line = "(Command was: %s)\n\n" % " ".join(sys.argv) + myfd.write(line.encode("utf-8")) summarylist(glsalist, fd1=myfd, fd2=myfd) - summary = str(myfd.getvalue()) + summary = myfd.getvalue().decode("utf-8") myfd.close() myattachments = [] @@ -395,9 +397,10 @@ if mode == "mail": if verbose: sys.stderr.write(("invalid GLSA: %s (error message was: %s)\n" % (myid, e))) continue - myfd = StringIO() + myfd = BytesIO() myglsa.dump(outstream=myfd) - myattachments.append(MIMEText(str(myfd.getvalue()), _charset="utf8")) + attachment = myfd.getvalue().decode("utf-8") + myattachments.append(MIMEText(attachment, _charset="utf8")) myfd.close() if glsalist or not quiet: |
