Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 260820 Details for
Bug 341293
app-portage/gentoolkit-0.3.0_rc10-r1: glsa-check TypeError in write
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch to avoid the type errors when sending the glsa-check mail
bug341293.patch (text/plain), 2.32 KB, created by
Andy Kittner
on 2011-01-27 00:01:11 UTC
(
hide
)
Description:
Patch to avoid the type errors when sending the glsa-check mail
Filename:
MIME Type:
Creator:
Andy Kittner
Created:
2011-01-27 00:01:11 UTC
Size:
2.32 KB
patch
obsolete
>From 3db8dc7527d29c525cc1c57c2dd49e2f6cc66661 Mon Sep 17 00:00:00 2001 >From: Andy Kittner <andkit@gmx.de> >Date: Thu, 27 Jan 2011 00:21:21 +0100 >Subject: [PATCH] Fix unicode vs. bytes issue in glsa-check (#341293) > >--- > bin/glsa-check | 17 ++++++++++------- > pym/gentoolkit/glsa/__init__.py | 1 + > 2 files changed, 11 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: >diff --git a/pym/gentoolkit/glsa/__init__.py b/pym/gentoolkit/glsa/__init__.py >index ab03947..af97ac6 100644 >--- a/pym/gentoolkit/glsa/__init__.py >+++ b/pym/gentoolkit/glsa/__init__.py >@@ -622,6 +622,7 @@ class Glsa: > @param outfile: Stream that should be used for writing > (defaults to sys.stdout) > """ >+ outstream = getattr(outstream, "buffer", outstream) > outstream = codecs.getwriter(encoding)(outstream) > width = int(self.config["PRINTWIDTH"]) > outstream.write(center("GLSA %s: \n%s" % (self.nr, self.title), width)+"\n") >-- >1.7.4.rc2.3.g60a2e.dirty >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 341293
: 260820