Page MenuHomePhabricator

Redirect error messages don't specify the pages
Closed, InvalidPublic

Description

When I call Page.get() on a redirect in the hope that I can get the redirect target (as promised by that documentation), I instead get a version of the error message with no page ever substituted in.

For instance, instead of Page Foo is a redirect page., I always get Page %s is a redirect page..

Event Timeline

IMO, it behaves as promised.
It doesn't say you will get the redirect target, it says you'll get an exception if page is a redirect.
Unless you specify get_redirect=True, which will give you the wikitext of page.

>>> import pywikibot
>>> site = pywikibot.Site('en', 'wikisource')
>>> page = pywikibot.Page(site, 'Author:Richard Lugar)  # a redirect
>>> page.get()
...
pywikibot.exceptions.IsRedirectPage: Page [[en:Author:Richard Lugar]] is a redirect page.

>>> page.get(get_redirect=True)
'#REDIRECT [[Author:Richard Green Lugar]]'

@Mpaa, in the example you provided, the %s was replaced by an actual page title. The bug I hope to address is that whenever I do it, the replacement doesn't happen and I get Page %s is a redirect page. instead of, say, Page [[en:Author:Richard Lugar]] is a redirect page..

I got that. But I am unable to reproduce your error.
Post the command you give when you get the error or share something that will allow others to reproduce it.

Works for me too, unable to reproduce this.
What version of pywikibot/python is this in ?

Framawiki subscribed.

Works well for me too. @APerson Please post the result of python pwb.py version if the bug is still present.