jenkins-bot merged this change.

View Change

Approvals: Dvorapa: Looks good to me, but someone else must approve Dalba: Looks good to me, approved jenkins-bot: Verified
[fix] Don't show wrong empty generator message in category.py

Bug: T196871
Change-Id: I94be5d408691c0ce35a59a27081b5ec2e5ae78d6
---
M pywikibot/bot.py
M scripts/category.py
2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index 1557b9d..0a65ca4 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -1210,6 +1210,7 @@

self._treat_counter = 0
self._save_counter = 0
+ self._generator_completed = False

@property
def current_page(self):
@@ -1509,6 +1510,8 @@
'\n%s: page count reached Python 2 sys.maxint (%d).\n'
'Python 3 should be used to process very large batches'
% (self.__class__.__name__, sys.maxint))
+ else:
+ self._generator_completed = True
except QuitKeyboardInterrupt:
pywikibot.output('\nUser quit %s bot run...' %
self.__class__.__name__)
diff --git a/scripts/category.py b/scripts/category.py
index efaeee6..35d53dd 100755
--- a/scripts/category.py
+++ b/scripts/category.py
@@ -1215,7 +1215,7 @@

def teardown(self):
"""Cleanups after run operation."""
- if not self._treat_counter:
+ if self._generator_completed and not self._treat_counter:
pywikibot.output('There are no pages or files in category {}'
.format(self.cat_title))


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

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I94be5d408691c0ce35a59a27081b5ec2e5ae78d6
Gerrit-Change-Number: 439553
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: Dalba <dalba.wiki@gmail.com>
Gerrit-Reviewer: Dvorapa <dvorapa@seznam.cz>
Gerrit-Reviewer: John Vandenberg <jayvdb@gmail.com>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444@gmail.com>
Gerrit-Reviewer: jenkins-bot