Revision: 7875 Author: xqt Date: 2010-01-14 08:53:49 +0000 (Thu, 14 Jan 2010)
Log Message: ----------- do not edit vandalized pages
Modified Paths: -------------- trunk/pywikipedia/redirect.py
Modified: trunk/pywikipedia/redirect.py =================================================================== --- trunk/pywikipedia/redirect.py 2010-01-13 07:15:42 UTC (rev 7874) +++ trunk/pywikipedia/redirect.py 2010-01-14 08:53:49 UTC (rev 7875) @@ -690,11 +690,15 @@ else: wikipedia.output( u' Links to: %s.' - % targetPage.aslink()) + % targetPage.aslink()) + if targetPage.site().sitename() == 'wikipedia:en' \ + and targetPage.title() == 'Target page name': + wikipedia.output(u"Skipping: Redirect source is vandalized.") + break if targetPage.site() != self.site: wikipedia.output( - u'Warning: redirect target (%s) is on a different site.' - % (targetPage.aslink())) + u'Warning: redirect target (%s) is on a different site.' + % (targetPage.aslink())) if self.always: break # skip if automatic # watch out for redirect loops @@ -703,8 +707,8 @@ targetPage.sectionFreeTitle()) ) > 0: wikipedia.output( - u'Warning: Redirect target %s forms a redirect loop.' - % targetPage.aslink()) + u'Warning: Redirect target %s forms a redirect loop.' + % targetPage.aslink()) break ###xqt doesn't work. edits twice! try: content = targetPage.get(get_redirect=True) @@ -761,7 +765,7 @@ % redir.title()) except wikipedia.Error, error: wikipedia.output( - u"Unexpected error occurred trying to save [[%s]]: %s" + u"Unexpected error occurred trying to save [[%s]]: %s" % (redir.title(), error)) break