[Reportbug-commits] [reportbug] 14/27: Finish open_url return type conversion
Sandro Tosi
morph at moszumanska.debian.org
Mon May 29 20:14:06 UTC 2017
This is an automated email from the git hooks/post-receive script.
morph pushed a commit to branch master
in repository reportbug.
commit d7e9eb8cc5d2efa4543bd35a806cbc36d7419e5e
Author: Nis Martensen <nis.martensen at web.de>
Date: Sat Apr 22 11:27:37 2017 +0200
Finish open_url return type conversion
The return type of reportbug/urlutils/open_url() was changed in
commit 5cf006943001a94bfafe0a40adbb1241950853de
from http.client.HTTPResponse to string. A few remaining open_url()
callers have not yet been updated, leading to breakage such as
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=859274
This commit updates the remaining callers to deal with strings, and
updates a few places to iterate over lines rather than characters.
---
reportbug/debbugs.py | 23 +++--------------------
reportbug/utils.py | 2 +-
2 files changed, 4 insertions(+), 21 deletions(-)
diff --git a/reportbug/debbugs.py b/reportbug/debbugs.py
index 85ccd45..f2e5830 100644
--- a/reportbug/debbugs.py
+++ b/reportbug/debbugs.py
@@ -968,16 +968,10 @@ def parse_html_report(number, url, http_proxy, timeout, followups=False, cgi=Tru
return None
parser = BTSParser(cgi=cgi, followups=followups)
- for line in page:
+ for line in page.splitlines():
parser.feed(line)
parser.close()
- try:
- page.fp._sock.recv = None
- except:
- pass
- page.close()
-
items = parser.preblock
title = "#%d: %s" % (number, parser.title)
@@ -1012,13 +1006,7 @@ def parse_mbox_report(number, url, http_proxy, timeout, followups=False):
return None
# Make this seekable
- wholefile = io.StringIO(page.read())
-
- try:
- page.fp._sock.recv = None
- except:
- pass
- page.close()
+ wholefile = io.StringIO(page)
mbox = mailbox.UnixMailbox(wholefile, msgfactory)
title = ''
@@ -1132,14 +1120,9 @@ def get_reports(package, timeout, system='debian', mirrors=None, version=None,
# return (0, None, None)
parser = BTSParser()
- for line in page:
+ for line in page.splitlines():
parser.feed(line)
parser.close()
- try:
- page.fp._sock.recv = None
- except:
- pass
- page.close()
return parser.bugcount, parser.title, parser.hierarchy
diff --git a/reportbug/utils.py b/reportbug/utils.py
index 401619f..f32ce43 100644
--- a/reportbug/utils.py
+++ b/reportbug/utils.py
@@ -1202,7 +1202,7 @@ def launch_mbox_reader(cmd, url, http_proxy, timeout):
return
(fd, fname) = TempFile()
try:
- for line in mbox:
+ for line in mbox.splitlines():
fd.write(line)
fd.close()
if cmd is not None:
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reportbug/reportbug.git
More information about the Reportbug-commits
mailing list