Revision: 4026 Author: btongminh Date: 2007-08-11 10:18:06 +0000 (Sat, 11 Aug 2007)
Log Message: ----------- Handle BadTitle
Modified Paths: -------------- trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2007-08-10 20:01:04 UTC (rev 4025) +++ trunk/pywikipedia/wikipedia.py 2007-08-11 10:18:06 UTC (rev 4026) @@ -192,6 +192,9 @@
class ServerError(Error): """Got unexpected server response""" + +class BadTitle(Error): + """Server responded with BadTitle."""
# UserBlocked exceptions should in general not be catched. If the bot has been # blocked, the bot operator has possibly done a mistake and should take care of @@ -596,6 +599,8 @@ # older MediaWiki versions don't have the 'nocreatetitle' message. elif self.site().has_mediawiki_message('nocreatetitle') and text.find(self.site().mediawiki_message('nocreatetitle')) != -1: raise LockedNoPage(u'%s does not exist, and page creation is forbidden for anonymous users.' % self.aslink()) + elif text.find('var wgPageName = "Special:Badtitle";'): + raise BadTitle(u'BadTitle: %s' % self) else: output( unicode(text) ) # We assume that the server is down. Wait some time, then try again.