jenkins-bot has submitted this change and it was merged.
Change subject: Bug 68665-misspelling fails if site not configured ......................................................................
Bug 68665-misspelling fails if site not configured
Instead of failing, a message is presented to the user.
It has also fixed a bug in case family=commons, replacing site.lang with site.code.
Change-Id: Ic1d2233d9983eb0875595f03f04bd5232e997e14 --- M scripts/misspelling.py 1 file changed, 18 insertions(+), 4 deletions(-)
Approvals: John Vandenberg: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/misspelling.py b/scripts/misspelling.py index 13f6b08..ec9644b 100644 --- a/scripts/misspelling.py +++ b/scripts/misspelling.py @@ -33,6 +33,15 @@ from pywikibot import i18n, pagegenerators from solve_disambiguation import DisambiguationRobot
+HELP_MSG = """\n +mispelling.py does not support site {site}. + +Help Pywikibot team to provide support for your wiki by submitting +a bug to: + https://bugzilla.wikimedia.org/enter_bug.cgi?product=Pywikibot +with category containing misspelling pages or a template for +these misspellings.\n""" +
class MisspellingRobot(DisambiguationRobot):
@@ -61,16 +70,15 @@
def createPageGenerator(self, firstPageTitle): mysite = pywikibot.Site() - mylang = mysite.lang + mylang = mysite.code if mylang in self.misspellingCategory: misspellingCategoryTitle = self.misspellingCategory[mylang] misspellingCategory = pywikibot.Category(mysite, misspellingCategoryTitle) generator = pagegenerators.CategorizedPageGenerator( misspellingCategory, recurse=True, start=firstPageTitle) - else: - misspellingTemplateName = 'Template:%s' \ - % self.misspellingTemplate[mylang] + elif mylang in self.misspellingTemplate: + misspellingTemplateName = 'Template:%s' % self.misspellingTemplate[mylang] misspellingTemplate = pywikibot.Page(mysite, misspellingTemplateName) generator = pagegenerators.ReferringPageGenerator( @@ -79,6 +87,12 @@ pywikibot.output( u'-start parameter unsupported on this wiki because there ' u'is no category for misspellings.') + else: + pywikibot.output(HELP_MSG.format(site=mysite)) + + empty_gen = (i for i in []) + return empty_gen + preloadingGen = pagegenerators.PreloadingGenerator(generator) return preloadingGen