jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/676729 )
Change subject: [bugfix] Fix bugs in imagetransfer.py
......................................................................
[bugfix] Fix bugs in imagetransfer.py
- Fix usage of -tofamily -tolang options in imagetransfer.py
- fix bot.skip_run()
- additional output of the transfer
- print a more readable messages in UploadRobot
- enable automatic_quit
Bug: T279232
Change-Id: Ic33049b1c44a4c1dc9d66f0a1666b8999685836f
---
M pywikibot/specialbots/_upload.py
M scripts/imagetransfer.py
2 files changed, 13 insertions(+), 10 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/specialbots/_upload.py b/pywikibot/specialbots/_upload.py
index 149f13d..9c53532 100644
--- a/pywikibot/specialbots/_upload.py
+++ b/pywikibot/specialbots/_upload.py
@@ -4,7 +4,7 @@
Do not import classes directly from here but from specialbots.
"""
#
-# (C) Pywikibot team, 2003-2020
+# (C) Pywikibot team, 2003-2021
#
# Distributed under the terms of the MIT license.
#
@@ -224,8 +224,8 @@
filename = self.filename_prefix + filename
if not self.keep_filename:
pywikibot.output(
- 'The filename on the target wiki will default to: %s'
- % filename)
+ '\nThe filename on the target wiki will default to: {}\n'
+ .format(filename))
assert not self.opt.always
newfn = pywikibot.input(
'Enter a better name, or press enter to accept:')
@@ -271,9 +271,9 @@
continue
if not pywikibot.input_yn(
- 'File format is not one of [%s], but %s. Continue?'
- % (' '.join(allowed_formats), ext),
- default=False, automatic_quit=False):
+ 'File format is not one of [{}], but {!r}. Continue?'
+ .format(' '.join(allowed_formats), ext),
+ default=False):
continue
potential_file_page = pywikibot.FilePage(self.target_site,
diff --git a/scripts/imagetransfer.py b/scripts/imagetransfer.py
index 43def4f..7581570 100755
--- a/scripts/imagetransfer.py
+++ b/scripts/imagetransfer.py
@@ -29,7 +29,7 @@
¶ms;
"""
#
-# (C) Pywikibot team, 2004-2020
+# (C) Pywikibot team, 2004-2021
#
# Distributed under the terms of the MIT license.
#
@@ -167,6 +167,9 @@
@return: the filename which was used to upload the image
"""
sourceSite = sourceImagePage.site
+ pywikibot.output(
+ '\n>>> Transfer {source} from {source.site} to {target}\n'
+ .format(source=sourceImagePage, target=self.opt.target))
url = sourceImagePage.get_file_url()
pywikibot.output('URL should be: ' + url)
# localize the text that should be printed on image description page
@@ -207,7 +210,7 @@
ignore_warning=self.opt.ignore_warning)
# try to upload
- if bot.self.skip_run():
+ if bot.skip_run():
return
target_filename = bot.upload_file(url)
@@ -353,8 +356,8 @@
if target_code or target_family:
site = pywikibot.Site()
options.setdefault('target',
- '{}:{}'.format(target_code or site.lang,
- target_family or site.family))
+ '{}:{}'.format(target_family or site.family,
+ target_code or site.lang))
bot = ImageTransferBot(generator=gen, **options)
bot.run()
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/676729
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ic33049b1c44a4c1dc9d66f0a1666b8999685836f
Gerrit-Change-Number: 676729
Gerrit-PatchSet: 4
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/676784 )
Change subject: [bugfix] Do not return a set with Page.isDisambig()
......................................................................
[bugfix] Do not return a set with Page.isDisambig()
if disambig_in_page is an empty set it may be returned
Change-Id: Ib4b4a51c98da13ebbc9840ac05e782998d7866de
---
M pywikibot/page/__init__.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page/__init__.py b/pywikibot/page/__init__.py
index 6a071b5..339d9a4 100644
--- a/pywikibot/page/__init__.py
+++ b/pywikibot/page/__init__.py
@@ -851,7 +851,7 @@
disambigs.update(self.site._disambigtemplates)
# see if any template on this page is in the set of disambigs
disambig_in_page = disambigs.intersection(templates)
- return self.namespace() != 10 and disambig_in_page
+ return self.namespace() != 10 and bool(disambig_in_page)
@deprecated_args(withTemplateInclusion='with_template_inclusion',
onlyTemplateInclusion='only_template_inclusion',
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/676784
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ib4b4a51c98da13ebbc9840ac05e782998d7866de
Gerrit-Change-Number: 676784
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged