jenkins-bot has submitted this change and it was merged.
Change subject: Break Page hard dependency on cosmetic_changes ......................................................................
Break Page hard dependency on cosmetic_changes
Allow import of 'scripts.cosmetic_changes' to fail gracefully.
Bug: T76320 Change-Id: If9aed100e592bb23ec246e3dce2896f9a1284be4 --- M pywikibot/page.py 1 file changed, 6 insertions(+), 2 deletions(-)
Approvals: John Vandenberg: Looks good to me, but someone else must approve Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py index fb80790..8df644f 100644 --- a/pywikibot/page.py +++ b/pywikibot/page.py @@ -1050,11 +1050,14 @@ self.site.lang in config.cosmetic_changes_disable[family])) if not cc: return + try: + from scripts.cosmetic_changes import CosmeticChangesToolkit + except ImportError: + pywikibot.log(u'Cosmetic changes module not available.') + return old = self.text pywikibot.log(u'Cosmetic changes for %s-%s enabled.' % (family, self.site.lang)) - from scripts.cosmetic_changes import CosmeticChangesToolkit - from pywikibot import i18n ccToolkit = CosmeticChangesToolkit(self.site, redirect=self.isRedirectPage(), namespace=self.namespace(), @@ -1063,6 +1066,7 @@ if comment and \ old.strip().replace('\r\n', '\n') != self.text.strip().replace('\r\n', '\n'): + from pywikibot import i18n comment += i18n.twtranslate(self.site, 'cosmetic_changes-append') return comment
pywikibot-commits@lists.wikimedia.org