jenkins-bot has submitted this change and it was merged.
Change subject: checkimages: use siteinfo fileextensions for allowed formats
......................................................................
checkimages: use siteinfo fileextensions for allowed formats
Bug: T120080
Change-Id: I075a4cd1c020392ea2f39fc6929ef621ef1ee65f
---
M scripts/checkimages.py
1 file changed, 10 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 fd77137..22a0946 100755
--- a/scripts/checkimages.py
+++ b/scripts/checkimages.py
@@ -1478,8 +1478,14 @@
# Don't put "}}" here, please. Useless and can give problems.
something = ['{{']
- # Unused file extensions. Does not contain PDF.
- notallowed = ("xcf", "xls", "sxw", "sxi",
"sxc", "sxd")
+ # Allowed extensions
+ try:
+ allowed_formats = self.site.siteinfo.get(
+ 'fileextensions', get_default=False)
+ except KeyError:
+ allowed_formats = []
+ else:
+ allowed_formats = [item['ext'].lower() for item in allowed_formats]
brackets = False
delete = False
notification = None
@@ -1527,9 +1533,8 @@
# There's a template, probably a license
brackets = True
# Is the extension allowed? (is it an image or f.e. a .xls file?)
- for parl in notallowed:
- if parl.lower() in extension.lower():
- delete = True
+ if allowed_formats and extension.lower() not in allowed_formats:
+ delete = True
(license_found, hiddenTemplateFound) = self.smartDetection()
# Here begins the check block.
if brackets and license_found:
--
To view, visit
https://gerrit.wikimedia.org/r/258111
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I075a4cd1c020392ea2f39fc6929ef621ef1ee65f
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Murfel <murnatty(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>