Revision: 4557 Author: rotem Date: 2007-11-15 14:26:29 +0000 (Thu, 15 Nov 2007)
Log Message: ----------- Using string.find properly.
Modified Paths: -------------- trunk/pywikipedia/replace.py trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/replace.py =================================================================== --- trunk/pywikipedia/replace.py 2007-11-15 13:33:42 UTC (rev 4556) +++ trunk/pywikipedia/replace.py 2007-11-15 14:26:29 UTC (rev 4557) @@ -184,14 +184,14 @@ def isTitleExcepted(self, title): if self.exceptions.has_key('title'): for exc in self.exceptions['title']: - if exc.search(title): + if exc.find(title) > -1: return True False
def isTextExcepted(self, text): if self.exceptions.has_key('text-contains'): for exc in self.exceptions['text-contains']: - if exc.search(text): + if exc.find(text) > -1: return True return False
@@ -246,7 +246,7 @@ """ if self.exceptions.has_key('title'): for exc in self.exceptions['title']: - if exc.search(title): + if exc.find(title) > -1: return True return False
@@ -256,7 +256,7 @@ """ if self.exceptions.has_key('text-contains'): for exc in self.exceptions['text-contains']: - if exc.search(original_text): + if exc.find(original_text) > -1: return True return False
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2007-11-15 13:33:42 UTC (rev 4556) +++ trunk/pywikipedia/wikipedia.py 2007-11-15 14:26:29 UTC (rev 4557) @@ -1259,7 +1259,7 @@ output(u"Pausing 5 seconds due to database server lag.") time.sleep(5) continue - if data.find( "<title>Wikimedia Error</title>"): + if data.find( "<title>Wikimedia Error</title>") > -1: output( u"Wikimedia has technical problems; will retry in %i minutes." % retry_delay)