[Python-checkins] r64901 - in python/trunk: Lib/robotparser.py Misc/ACKS
benjamin.peterson
python-checkins at python.org
Sun Jul 13 01:41:19 CEST 2008
Author: benjamin.peterson
Date: Sun Jul 13 01:41:19 2008
New Revision: 64901
Log:
#1778443 robotparser fixes from Aristotelis Mikropoulos
Modified:
python/trunk/Lib/robotparser.py
python/trunk/Misc/ACKS
Modified: python/trunk/Lib/robotparser.py
==============================================================================
--- python/trunk/Lib/robotparser.py (original)
+++ python/trunk/Lib/robotparser.py Sun Jul 13 01:41:19 2008
@@ -55,11 +55,8 @@
"""Reads the robots.txt URL and feeds it to the parser."""
opener = URLopener()
f = opener.open(self.url)
- lines = []
- line = f.readline()
- while line:
- lines.append(line.strip())
- line = f.readline()
+ lines = [line.strip() for line in f]
+ f.close()
self.errcode = opener.errcode
if self.errcode in (401, 403):
self.disallow_all = True
@@ -84,7 +81,7 @@
entry = Entry()
for line in lines:
- linenumber = linenumber + 1
+ linenumber += 1
if not line:
if state == 1:
entry = Entry()
Modified: python/trunk/Misc/ACKS
==============================================================================
--- python/trunk/Misc/ACKS (original)
+++ python/trunk/Misc/ACKS Sun Jul 13 01:41:19 2008
@@ -460,6 +460,7 @@
Mike Meyer
Steven Miale
Trent Mick
+Aristotelis Mikropoulos
Damien Miller
Chad Miller
Jay T. Miller
More information about the Python-checkins
mailing list