Page MenuHomePhabricator

isDisambig results in AttributeError
Closed, ResolvedPublic

Description

Author: themineo+wikibz

Description:
In [1]: import pywikibot
In [2]: s = pywikibot.Site("et", "wikipedia")
In [3]: p = pywikibot.Page(s, "Hannes Varblane")

In [4]: p.isDisambig()

AttributeError Traceback (most recent call last)
<ipython-input-4-af3848c4be35> in <module>()
----> 1 p.isDisambig()

/home/wieland/dev/pywikibot-core/pywikibot/page.pyc in isDisambig(self, get_Index)

569         if self.site.hasExtension('Disambiguator', False):
570             # If the Disambiguator extension is loaded, use it

--> 571 return 'disambiguation' in self.properties()

572 
573         if not hasattr(self.site, "_disambigtemplates"):

/home/wieland/dev/pywikibot-core/pywikibot/page.pyc in properties(self, force)

379         if not hasattr(self, '_pageprops') or force:
380             self.site.loadpageprops(self)

--> 381 return self._pageprops

382 
383     def defaultsort(self, force=False):

AttributeError: 'Page' object has no attribute '_pageprops'

» git describe --always --dirty
a987c8e-dirty

(Dirty here refers to the submodules having been updated)

This is obviously using the core branch.


Version: core-(2.0)
Severity: major
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=54684

Details

Reference
bz54868

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 2:33 AM
bzimport set Reference to bz54868.
bzimport added a subscriber: Unknown Object (????).

Change 87060 had a related patch set uploaded by FelixReimann:
Set _pageprops to {} per default before updating from live site as - a page without any pageprops has no corresponding entry in the pagedict and, thus, Page._pageprops will not be set in api.update_page() - the pageprops may be removed after a forced upda

https://gerrit.wikimedia.org/r/87060

Keeping this open so someone can work on a better solution than the current one.

Change 87060 merged by jenkins-bot:
Bug 54868 - isDisambig results in AttributeError

https://gerrit.wikimedia.org/r/87060

Change 96951 had a related patch set uploaded by Legoktm:
Return an empty array if there are no page properties

https://gerrit.wikimedia.org/r/96951

(In reply to comment #2)

Keeping this open so someone can work on a better solution than the current
one.

Fixing MediaWiki sounds like a better solution to me :)

Change 96951 abandoned by Legoktm:
Return an empty array if there are no page properties

https://gerrit.wikimedia.org/r/96951