Revision: 6452 Author: multichill Date: 2009-02-28 16:17:31 +0000 (Sat, 28 Feb 2009)
Log Message: ----------- Some extra page checks
Modified Paths: -------------- trunk/pywikipedia/commonscat.py
Modified: trunk/pywikipedia/commonscat.py =================================================================== --- trunk/pywikipedia/commonscat.py 2009-02-28 16:03:53 UTC (rev 6451) +++ trunk/pywikipedia/commonscat.py 2009-02-28 16:17:31 UTC (rev 6452) @@ -264,12 +264,13 @@
def findCommonscatLink (page=None): for ipage in page.interwiki(): - possibleCommonscat = getCommonscatLink (ipage) - if (possibleCommonscat!= u''): - checkedCommonscat = checkCommonscatLink(possibleCommonscat) - if (checkedCommonscat!= u''): - wikipedia.output("Found link for " + page.title() + " at [[" + ipage.site().language() + ":" + ipage.title() + "]] to " + checkedCommonscat + ".") - return checkedCommonscat + if(ipage.exists() and not ipage.isRedirectPage() and not ipage.isDisambig()): + possibleCommonscat = getCommonscatLink (ipage) + if (possibleCommonscat!= u''): + checkedCommonscat = checkCommonscatLink(possibleCommonscat) + if (checkedCommonscat!= u''): + wikipedia.output("Found link for " + page.title() + " at [[" + ipage.site().language() + ":" + ipage.title() + "]] to " + checkedCommonscat + ".") + return checkedCommonscat return u''
@@ -354,7 +355,8 @@ pregenerator = pagegenerators.PreloadingGenerator(generator)
for page in pregenerator: - (status, always) = addCommonscat(page, summary, always) + if(page.exists() and not page.isRedirectPage() and not page.isDisambig()): + (status, always) = addCommonscat(page, summary, always)
if __name__ == "__main__": try: