Last modified: 2014-10-07 08:31:33 UTC
When calling page.isDisambig() a page.isRedirectPage() followed after that is reporting it always false. Calling 'page.text' does 'fix' that so that it returns the actual value. >>> import pywikibot >>> enwp = pywikibot.Site('en', 'wikipedia') >>> page = pywikibot.Page(enwp, 'TBBT') >>> page.isRedirectPage() True >>> page = pywikibot.Page(enwp, 'TBBT') >>> not page.isDisambig() True >>> page.isRedirectPage() False >>> page.text '#REDIRECT [[The Big Bang Theory]]' >>> page.isRedirectPage() True
Okay the reason is the following: Page.isDisambig() calls site.loadpageprops() which loads them and calls data.api.update_page() and this isn't differentiating between prop=pageprops and prop=info, and 'pageprops' is no redirect info. I'd like to know if there is a reason when to use prop=pageprops? It looks to me all the data is also in prop=info. Another fix would be, to only update those properties which have been received, because the property is not present if it's False so it needs to know if that property is not present because it's False or because it wasn't requested.
Change 162157 had a related patch set uploaded by XZise: [FIX] API: Don't set 'redirect' value if it couldn't be returned https://gerrit.wikimedia.org/r/162157
Okay 'prop=pageprops' doesn't work how I thought it worked. And because there are other cases in which update_page was called, I made a more general fix: 'update_page' now receives the property with which the pagedict was obtained. If any value in the result is only present for a specific property and a missing value could indicate that it's False or not requested, this does allow an easy check to determine between both possibilites.
Change 162157 merged by jenkins-bot: [FIX] API: Don't set 'redirect' value if it couldn't be returned https://gerrit.wikimedia.org/r/162157