Last modified: 2014-10-07 08:31:33 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T73104, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 71104 - page.isRedirectPage() reports always False after page.isDisambig()
page.isRedirectPage() reports always False after page.isDisambig()
Status: RESOLVED FIXED
Product: Pywikibot
Classification: Unclassified
General (Other open bugs)
core-(2.0)
All All
: High normal
: ---
Assigned To: Pywikipedia bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-09-21 22:57 UTC by Fabian
Modified: 2014-10-07 08:31 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Fabian 2014-09-21 22:57:02 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
Comment 1 Fabian 2014-09-22 22:42:50 UTC
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.
Comment 2 Gerrit Notification Bot 2014-09-22 23:08:56 UTC
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
Comment 3 Fabian 2014-09-22 23:11:49 UTC
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.
Comment 4 Gerrit Notification Bot 2014-09-28 14:10:52 UTC
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

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links