jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/503736 )
Change subject: [bugfix] Show page list at the end of the script ......................................................................
[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(-)
Approvals: Dvorapa: Looks good to me, approved jenkins-bot: Verified
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)