From bc0e9108261693b6278687f4fb4709ff76c2e543 Mon Sep 17 00:00:00 2001 From: Tim Peters Date: Thu, 4 Apr 2002 22:55:58 +0000 Subject: Convert a pile of obvious "yes/no" functions to return bool. --- Lib/robotparser.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'Lib/robotparser.py') 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: -- cgit v1.2.1