summaryrefslogtreecommitdiff
path: root/Lib/robotparser.py
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2002-04-04 22:55:58 +0000
committerTim Peters <tim.peters@gmail.com>2002-04-04 22:55:58 +0000
commitbc0e9108261693b6278687f4fb4709ff76c2e543 (patch)
treeafef5d4734034ed0268950cf06321aefd4154ff3 /Lib/robotparser.py
parent2f486b7fa6451b790b154e6e4751239d69d46952 (diff)
downloadcpython-git-bc0e9108261693b6278687f4fb4709ff76c2e543.tar.gz
Convert a pile of obvious "yes/no" functions to return bool.
Diffstat (limited to 'Lib/robotparser.py')
-rw-r--r--Lib/robotparser.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/robotparser.py b/Lib/robotparser.py
index 5b759d4968..99bcdae2f1 100644
--- a/Lib/robotparser.py
+++ b/Lib/robotparser.py
@@ -134,9 +134,9 @@ class RobotFileParser:
_debug("Checking robot.txt allowance for:\n user agent: %s\n url: %s" %
(useragent, url))
if self.disallow_all:
- return 0
+ return False
if self.allow_all:
- return 1
+ return True
# search for given user agent matches
# the first match counts
url = urllib.quote(urlparse.urlparse(urllib.unquote(url))[2]) or "/"
@@ -147,7 +147,7 @@ class RobotFileParser:
if self.default_entry:
return self.default_entry.allowance(url)
# agent not found ==> access granted
- return 1
+ return True
def __str__(self):
@@ -195,11 +195,11 @@ class Entry:
for agent in self.useragents:
if agent=='*':
# we have the catch-all agent
- return 1
+ return True
agent = agent.lower()
if useragent.find(agent) != -1:
- return 1
- return 0
+ return True
+ return False
def allowance(self, filename):
"""Preconditions: