Revision: 5137 Author: btongminh Date: 2008-03-16 20:02:16 +0000 (Sun, 16 Mar 2008)
Log Message: ----------- Don't iterate on TTP or TSP if they are None. (patch by NicDumZ)
Modified Paths: -------------- trunk/pywikipedia/blockpageschecker.py
Modified: trunk/pywikipedia/blockpageschecker.py =================================================================== --- trunk/pywikipedia/blockpageschecker.py 2008-03-16 12:30:29 UTC (rev 5136) +++ trunk/pywikipedia/blockpageschecker.py 2008-03-16 20:02:16 UTC (rev 5137) @@ -161,14 +161,16 @@
def understandBlock(text, TTP, TSP, TSMP, TTMP): """ Understand if the page is blocked and if it has the right template """ - for catchRegex in TTP: # TTP = templateTotalProtection - resultCatch = re.findall(catchRegex, text) - if resultCatch != []: - return ('sysop-total', catchRegex) - for catchRegex in TSP: - resultCatch = re.findall(catchRegex, text) - if resultCatch != []: - return ('autoconfirmed-total', catchRegex) + if TTP: + for catchRegex in TTP: # TTP = templateTotalProtection + resultCatch = re.findall(catchRegex, text) + if resultCatch != []: + return ('sysop-total', catchRegex) + if TSP: + for catchRegex in TSP: + resultCatch = re.findall(catchRegex, text) + if resultCatch != []: + return ('autoconfirmed-total', catchRegex) if TSMP != None and TTMP != None and TTP != TTMP and TSP != TSMP: for catchRegex in TSMP: resultCatch = re.findall(catchRegex, text)