jenkins-bot has submitted this change and it was merged.
Change subject: Fix port of imagetransfer ......................................................................
Fix port of imagetransfer
Using the script with -interwiki or a page other than an image resulted in exceptions due to incorrect usage of core library.
Bug: T86627 Change-Id: I941b9d72467b98378f2ef66c52b8d22261a3e5d9 --- M scripts/imagetransfer.py 1 file changed, 5 insertions(+), 4 deletions(-)
Approvals: John Vandenberg: Looks good to me, approved XZise: Looks good to me, but someone else must approve jenkins-bot: Verified
diff --git a/scripts/imagetransfer.py b/scripts/imagetransfer.py index 12d4e3e..94a1739 100644 --- a/scripts/imagetransfer.py +++ b/scripts/imagetransfer.py @@ -266,14 +266,15 @@ if self.interwiki: imagelist = [] for linkedPage in page.interwiki(): - imagelist.append(linkedPage.imagelinks(followRedirects=True)) + linkedPage = pywikibot.Page(linkedPage) + imagelist.extend( + linkedPage.imagelinks( + followRedirects=True)) elif page.isImage(): imagePage = pywikibot.FilePage(page.site, page.title()) imagelist = [imagePage] else: - imagePage = (page.imagelinks(followRedirects=True)).result( - {'title': page.title(), 'ns': pywikibot.Site().image_namespace()}) - imagelist = [imagePage] + imagelist = list(page.imagelinks(followRedirects=True))
while len(imagelist) > 0: self.showImageList(imagelist)