jenkins-bot merged this change.
[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.