http://www.mediawiki.org/wiki/Special:Code/pywikipedia/10848
Revision: 10848
Author: xqt
Date: 2012-12-30 14:12:30 +0000 (Sun, 30 Dec 2012)
Log Message:
-----------
lookup in the movelog table if the source page does not exist. Maybe it has been deleted
after moving without fixing redirects.
Modified Paths:
--------------
trunk/pywikipedia/fixing_redirects.py
Modified: trunk/pywikipedia/fixing_redirects.py
===================================================================
--- trunk/pywikipedia/fixing_redirects.py 2012-12-30 13:38:38 UTC (rev 10847)
+++ trunk/pywikipedia/fixing_redirects.py 2012-12-30 14:12:30 UTC (rev 10848)
@@ -169,6 +169,14 @@
for page2 in links:
try:
target = page2.getRedirectTarget()
+ except pywikibot.NoPage:
+ gen = s.logpages(number=1, mode='move', title=page2.title(),
+ dump=True)
+ try:
+ lastmove = gen.next()['move']
+ except StopIteration:
+ continue
+ target = pywikibot.Page(mysite, lastmove['new_title'])
except (pywikibot.Error, pywikibot.SectionError):
continue
# no fix to user namespaces