Revision: 7001 Author: russblau Date: 2009-06-26 21:42:28 +0000 (Fri, 26 Jun 2009)
Log Message: ----------- Catch a CircularRedirect exception
Modified Paths: -------------- branches/rewrite/scripts/category_redirect.py
Modified: branches/rewrite/scripts/category_redirect.py =================================================================== --- branches/rewrite/scripts/category_redirect.py 2009-06-26 21:39:25 UTC (rev 7000) +++ branches/rewrite/scripts/category_redirect.py 2009-06-26 21:42:28 UTC (rev 7001) @@ -406,7 +406,13 @@ if page.isCategoryRedirect(): # this is already a soft-redirect, so skip it (for now) continue - target = page.getRedirectTarget() + try: + target = page.getRedirectTarget() + except pywikibot.CircularRedirect: + target = page + problems.append( + u"# %s is a self-linked redirect" + % page.title(asLink=True, textlink=True)) if target.namespace() == 14: # this is a hard-redirect to a category page newtext = (u"{{%(template)s|%(cat)s}}"