jenkins-bot has submitted this change and it was merged.
Change subject: [Bugfix] Don't format strings if they don't exists ......................................................................
[Bugfix] Don't format strings if they don't exists
- assign delete_immediately message to msg_del_comm message before adding line feed. - move di assignments to needed code part. Otherwise the script would break. - Skip processing if no msg are given - remove outdated comment
Change-Id: I4afdb32cb84e70b2e33c34d2c350c7bb75925558 --- M scripts/checkimages.py 1 file changed, 9 insertions(+), 5 deletions(-)
Approvals: John Vandenberg: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/checkimages.py b/scripts/checkimages.py index 5aeba66..b04e6d0 100755 --- a/scripts/checkimages.py +++ b/scripts/checkimages.py @@ -1501,10 +1501,6 @@ dels = i18n.translate(self.site, msg_del_comm, fallback=True) smwl = i18n.translate(self.site, second_message_without_license)
- # Some formatting for delete immediately template - di = u'\n%s' % di - dels = dels % di - try: self.imageCheckText = self.image.get() except pywikibot.NoPage: @@ -1537,10 +1533,18 @@ (license_found, hiddenTemplateFound) = self.smartDetection() # Here begins the check block. if brackets and license_found: - # It works also without this... but i want only to be sure ^^ return True elif delete: pywikibot.output(u"%s is not a file!" % self.imageName) + if not (di and din and dih): + pywikibot.output( + "No localized message given for 'delete_immediately' or " + "'delete_immediately_notification' or " + "'delete_immediately_head'. Skipping.") + return + # Some formatting for delete immediately template + dels = dels % di + di = '\n' + di # Modify summary text pywikibot.setAction(dels) canctext = di % extension
pywikibot-commits@lists.wikimedia.org