Revision: 5818 Author: multichill Date: 2008-08-19 21:03:42 +0000 (Tue, 19 Aug 2008)
Log Message: ----------- Fix template uncat
Modified Paths: -------------- trunk/pywikipedia/imagerecat.py
Modified: trunk/pywikipedia/imagerecat.py =================================================================== --- trunk/pywikipedia/imagerecat.py 2008-08-19 20:18:07 UTC (rev 5817) +++ trunk/pywikipedia/imagerecat.py 2008-08-19 21:03:42 UTC (rev 5818) @@ -33,7 +33,7 @@ commonshelperCats = getCommonshelperCats(imagepage) newcats = filterBlacklist(commonshelperCats+currentCats) newcats = filterDisambiguation(newcats) - newcats = filterRedirects(newcats) + newcats = followRedirects(newcats) #newcats = filterCountries(newcats) newcats = filterParents(newcats) if len(newcats) > 0: @@ -96,7 +96,7 @@ result.append(cat) return result
-def filterRedirects(categories): +def followRedirects(categories): result = [] for cat in categories: categoryPage = wikipedia.Page(wikipedia.getSite(), u'Category:' + cat) @@ -150,7 +150,7 @@ result = u'' result = re.sub(u'{{\s*([Uu]ncat(egori[sz]ed( image)?)?|[Nn]ocat|[Nn]eedscategory)[^}]*}}', u'', oldtext) result = re.sub(u'<!-- Remove this line once you have added categories -->', u'', result) - result = re.sub(u'{{\s*[Cc]heck categories[^}]*}}', u'', oldtext) + result = re.sub(u'{{\s*[Cc]heck categories[^}]*}}', u'', result) return result