jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/959385 )
Change subject: [IMPR] use Site.file_extensions within checkimages.py and _upload.py ......................................................................
[IMPR] use Site.file_extensions within checkimages.py and _upload.py
Note: fileextension property of siteinfo was introduced with mw 1.15 but the KeyError catch was inroduced to support mw 1.14, see T120080 and https://gerrit.wikimedia.org/r/c/pywikibot/core/+/223021/7
Change-Id: If21554ec7517eb7fe9624a02eabacbb30a078ce3 --- M pywikibot/specialbots/_upload.py M scripts/checkimages.py 2 files changed, 15 insertions(+), 15 deletions(-)
Approvals: JJMC89: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/specialbots/_upload.py b/pywikibot/specialbots/_upload.py index c3f1c7a..045ac27 100644 --- a/pywikibot/specialbots/_upload.py +++ b/pywikibot/specialbots/_upload.py @@ -240,13 +240,7 @@ # FIXME: these 2 belong somewhere else, presumably in family # forbidden characters are handled by pywikibot/page.py forbidden = ':*/\' # to be extended - try: - allowed_formats = self.target_site.siteinfo.get( - 'fileextensions', get_default=False) - except KeyError: - allowed_formats = [] - else: - allowed_formats = [item['ext'] for item in allowed_formats] + allowed_formats = self.target_site.file_extensions()
# ask until it's valid first_check = True diff --git a/scripts/checkimages.py b/scripts/checkimages.py index 1c4e69e..06fafe9 100755 --- a/scripts/checkimages.py +++ b/scripts/checkimages.py @@ -1429,14 +1429,7 @@
# Don't put "}}" here, please. Useless and can give problems. something = ['{{'] - # 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] + allowed_formats = self.site.file_extensions() # Allowed extensions brackets = False delete = False notification = None
pywikibot-commits@lists.wikimedia.org