[Python-checkins] CVS: python/dist/src/Lib robotparser.py,1.6,1.7
Eric S. Raymond
esr@users.sourceforge.net
Fri, 09 Feb 2001 00:40:43 -0800
Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv21719
Modified Files:
robotparser.py
Log Message:
String method conversion.
Index: robotparser.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/robotparser.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** robotparser.py 2001/01/21 04:49:16 1.6
--- robotparser.py 2001/02/09 08:40:40 1.7
***************
*** 10,14 ****
http://info.webcrawler.com/mak/projects/robots/norobots-rfc.html
"""
! import re,string,urlparse,urllib
__all__ = ["RobotFileParser"]
--- 10,14 ----
http://info.webcrawler.com/mak/projects/robots/norobots-rfc.html
"""
! import re,urlparse,urllib
__all__ = ["RobotFileParser"]
***************
*** 72,76 ****
for line in lines:
! line = string.strip(line)
linenumber = linenumber + 1
if not line:
--- 72,76 ----
for line in lines:
! line = line.strip()
linenumber = linenumber + 1
if not line:
***************
*** 86,99 ****
state = 0
# remove optional comment and strip line
! i = string.find(line, '#')
if i>=0:
line = line[:i]
! line = string.strip(line)
if not line:
continue
! line = string.split(line, ':', 1)
if len(line) == 2:
! line[0] = string.lower(string.strip(line[0]))
! line[1] = string.strip(line[1])
if line[0] == "user-agent":
if state==2:
--- 86,99 ----
state = 0
# remove optional comment and strip line
! i = line.find('#')
if i>=0:
line = line[:i]
! line = line.strip()
if not line:
continue
! line = line.split(':', 1)
if len(line) == 2:
! line[0] = line[0].strip().lower()
! line[1] = line[1].strip()
if line[0] == "user-agent":
if state==2:
***************
*** 137,141 ****
# search for given user agent matches
# the first match counts
! useragent = string.lower(useragent)
url = urllib.quote(urlparse.urlparse(url)[2])
for entry in self.entries:
--- 137,141 ----
# search for given user agent matches
# the first match counts
! useragent = useragent.lower()
url = urllib.quote(urlparse.urlparse(url)[2])
for entry in self.entries: