Revision: 4438
Author: cosoleto
Date: 2007-10-10 09:34:00 +0000 (Wed, 10 Oct 2007)
Log Message:
-----------
Python 2.4 compatibility fix
Modified Paths:
--------------
trunk/pywikipedia/copyright.py
Modified: trunk/pywikipedia/copyright.py
===================================================================
--- trunk/pywikipedia/copyright.py 2007-10-09 17:41:43 UTC (rev 4437)
+++ trunk/pywikipedia/copyright.py 2007-10-10 09:34:00 UTC (rev 4438)
@@ -316,7 +316,11 @@
except KeyboardInterrupt:
raise
except wikipedia.IsRedirectPage, arg:
- data = wikipedia.Page(page.site(), arg).get()
+ if isinstance(arg, wikipedia.IsRedirectPage):
+ newtitle = arg.args[0]
+ else:
+ newtitle = arg.message
+ data = wikipedia.Page(page.site(), newtitle).get()
except:
error('Getting page failed')
return
@@ -989,8 +993,12 @@
wikipedia.output(u'Page %s not found' % page.title())
continue
except wikipedia.IsRedirectPage, error:
- wikipedia.output(u'Page %s redirect to \'%s\'' % (page.aslink(), error.message))
- bot = CheckRobot(iter([wikipedia.Page(page.site(), error.message),]))
+ if isinstance(error, wikipedia.IsRedirectPage):
+ newtitle = error.args[0]
+ else:
+ newtitle = error.message
+ wikipedia.output(u'Page %s redirect to \'%s\'' % (page.aslink(), newtitle))
+ bot = CheckRobot(iter([wikipedia.Page(page.site(), newtitle),]))
bot.run()
continue