jenkins-bot merged this change.

View Change

Approvals: Dvorapa: Looks good to me, approved jenkins-bot: Verified
[bugfix] Show page list at the end of the script

With -get option the page content is printed after the page title
but complete title list is not printed in this case.

Bug: T220905
Change-Id: I65bb48d733cb92864694b9180d5e040a19cb6b98
---
M scripts/listpages.py
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/scripts/listpages.py b/scripts/listpages.py
index 1ec6268..1292c20 100755
--- a/scripts/listpages.py
+++ b/scripts/listpages.py
@@ -259,8 +259,9 @@
if not notitle:
page_fmt = Formatter(page, outputlang)
output_list += [page_fmt.output(num=i, fmt=fmt)]
- pywikibot.stdout(output_list[-1])
if page_get:
+ if output_list:
+ pywikibot.stdout(output_list.pop(-1))
try:
pywikibot.stdout(page.text)
except pywikibot.Error as err:
@@ -271,10 +272,12 @@
.format(page.title(), filename))
with open(filename, mode='wb') as f:
f.write(page.text.encode(encoding))
- pywikibot.output('{0} page(s) found'.format(i))
+ text = '\n'.join(output_list)
if page_target:
- page_target.text = '\n'.join(output_list)
+ page_target.text = text
page_target.save(summary=summary)
+ pywikibot.stdout(text)
+ pywikibot.output('{0} page(s) found'.format(i))
return True
else:
pywikibot.bot.suggest_help(missing_generator=True)

To view, visit change 503736. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I65bb48d733cb92864694b9180d5e040a19cb6b98
Gerrit-Change-Number: 503736
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki@aol.com>
Gerrit-Reviewer: Dvorapa <dvorapa@seznam.cz>
Gerrit-Reviewer: John Vandenberg <jayvdb@gmail.com>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot (75)