jenkins-bot has submitted this change and it was merged.
Change subject: Use the Disambiguator extension if available ......................................................................
Use the Disambiguator extension if available
Change-Id: I4842eb46bcd17334d5fb063de813558153bdd8f3 --- M pywikibot/page.py M tests/page_tests.py 2 files changed, 18 insertions(+), 0 deletions(-)
Approvals: Legoktm: Looks good to me, but someone else must approve Merlijn van Deen: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py index 4b99a31..d3a393e 100644 --- a/pywikibot/page.py +++ b/pywikibot/page.py @@ -563,6 +563,11 @@ appended regardless of its existence.
""" + + if self.site.hasExtension('Disambiguator', False): + # If the Disambiguator extension is loaded, use it + return 'disambiguation' in self.properties() + if not hasattr(self.site, "_disambigtemplates"): try: default = set(self.site.family.disambig('_default')) diff --git a/tests/page_tests.py b/tests/page_tests.py index f828c33..48f40fe 100644 --- a/tests/page_tests.py +++ b/tests/page_tests.py @@ -245,6 +245,19 @@ self.assertType(mainpage.previousRevision(), int) self.assertType(mainpage.permalink(), basestring)
+ def testIsDisambig(self): + """ + Test the integration with + Extension:Disambiguator + """ + if not site.hasExtension('Disambiguator', False): + raise unittest.SkipTest('Disambiguator extension not loaded on test site') + pg = pywikibot.Page(site, 'Random') + pg._pageprops = {'disambiguation', ''} + self.assertTrue(pg.isDisambig()) + pg._pageprops = {} + self.assertFalse(pg.isDisambig()) + def testReferences(self): count = 0 #Ignore redirects for time considerations
pywikibot-commits@lists.wikimedia.org