Revision: 8056 Author: xqt Date: 2010-04-06 07:55:06 +0000 (Tue, 06 Apr 2010)
Log Message: ----------- Ignore invalid title error (bugfix #2981290)
Modified Paths: -------------- trunk/pywikipedia/selflink.py
Modified: trunk/pywikipedia/selflink.py =================================================================== --- trunk/pywikipedia/selflink.py 2010-04-06 07:35:40 UTC (rev 8055) +++ trunk/pywikipedia/selflink.py 2010-04-06 07:55:06 UTC (rev 8056) @@ -109,11 +109,18 @@ should be reset to 0. This is required after the user has edited the article. """ - # ignore interwiki links and links to sections of the same page as well as section links - if not match.group('title') or page.site().isInterwikiLink(match.group('title')) or match.group('section'): + # ignore interwiki links and links to sections of the same page as well + # as section links + if not match.group('title') \ + or page.site().isInterwikiLink(match.group('title')) \ + or match.group('section'): return text, False - - linkedPage = wikipedia.Page(page.site(), match.group('title')) + try: + linkedPage = wikipedia.Page(page.site(), match.group('title')) + except wikipedia.InvalidTitle, err: + wikipedia.output(u'Warning: %s' % err) + return text, False + # Check whether the link found is to the current page itself. if linkedPage != page: # not a self-link