Xqt has uploaded a new change for review.

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

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, 6 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/80/261180/1

diff --git a/scripts/checkimages.py b/scripts/checkimages.py
index 22a0946..ffa337d 100755
--- a/scripts/checkimages.py
+++ b/scripts/checkimages.py
@@ -1502,10 +1502,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:
@@ -1538,10 +1534,15 @@
         (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 dih):
+                pywikibot.output('No speedy deletion template given. 
Skipping.')
+                return
+            # Some formatting for delete immediately template
+            dels = dels % di
+            di = '\n' + di
             # Modify summary text
             pywikibot.setAction(dels)
             canctext = di % extension

-- 
To view, visit https://gerrit.wikimedia.org/r/261180
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4afdb32cb84e70b2e33c34d2c350c7bb75925558
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to